Laan's steps..

Feed Rss

The read/write conflict of sol files

01.21.2010, flash, by .

That it very infrequent. When you read and write a same sol files with API of SharedObject frequently. Like following:

setTimeout(readAndWrite, 50);

function readAndWrite():void {
var so:SharedObject = SharedObject.getLocal("test", "/");
if (!so.data.num) so.data.num = 1;
so.data.num++;
so.flush();

trace(so.data.num);
}

Run two instances of this codes. There will be a read/write conflict in that instructions. What will happen next?
When a sol file is be open by flashplayer, the file is read only now. So, if the other app tries to write data, a error will throw. And than, the flashplayer will create a copy of that sol file, change the file type to .sxx, write data that .sxx file.

After that, your data is writed to the .sxx file. Next time runing the app to write data. If the sol is writable, the data of .sxx file will move to the sol file, or the data will still writed to .sxx file. Again and again…

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>