[REBOL] Re: RIM Server
From: deadzaphod:programmer at: 1-Jun-2001 2:34
here's the code I use to avoid collisions with my CGI scripts, I've been
using it for about 6 months now and it seems to work well.
try-get-filelock: func [ file ] [ not error? try [ make-dir rejoin [
%file-lock- file "/" ] ] ]
free-filelock: func [ file ] [ delete rejoin [ %file-lock- file "/" ]
return ]
get-filelock: func [ file retries /local retry ] [
retry: 0
while [not try-get-filelock file] [
wait 0.5
if (retry: retry + 1) > retries [ return false ]
]
return true
]
; Cal Dixon
; -><-