Am Donnerstag, 3. Juli 2014 15:54:41 UTC+2 schrieb Jeremy Ruston:
>
> The trouble with trying to use a lockfile with TiddlyWiki is that we don't 
> have atomic file operations. 
>

Is renaming a file atomic? If so, we have at least one means which could 
work.

We need to define a lockfile which must exist in order to be able to get a 
lock. I'd do it like this:

my_lock= lockfilename + SomeRandomNumberOrProcessID
while not rename lockfilename to my_lock
    if no more retries allowed -> Couldn't get lock
    sleep a while
end while
Got the lock
do something
rename my_lock to lockfilename

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to