Thank you Mr. Kracik!
If only I undersatood completely whats going on in the script. Please
correct me if I´m wrong:
1.Files in use are flagged with "semaphore"
2. The files in use are renamed as "%lock.locked"
The script loops, continues to "Try" to rename, if it encounters an error
then it "waits". Wonßt I get an error anyway if the file is directly
renamed when I CGI script user requests a file?
Excuse my newbie question
Best regards
Sharriff Aina
med.iq information & quality in healthcare AG
Gutenbergstr. 42
[EMAIL PROTECTED]
km.cz An: [EMAIL PROTECTED]
Kopie:
11.10.00 Thema: [REBOL] How does one persist data?
Re:
21:56
Bitte
antworten an
list
Hi Sharriff,
be careful when saving to a file and reading it later, as many users
may run your CGI programs simultaneously. You should use some form of
inter-process synchronization to serialize access to your file. AFAIK
from REBOL you can reliably synchronize by opening TCP sockets or
renaming a file. I use these two functions:
obtain-semaphore: func [] [
loop 100 [
if not error? try [ rename %lockdir/lock %lock.locked ] [
return
]
wait ( random 5 ) / 10
]
print "Could not obtain semaphore"
quit
]
release-semaphore: func [] [
loop 100 [
if not error? try [ rename %lockdir/lock.locked %lock ] [
return
]
wait ( random 5 ) / 10
]
print "Could not release semaphore"
quit
]
--
Michal Kracik
[EMAIL PROTECTED] wrote:
>
> Does anyone have a soultion of persisting data across HTML pages? I want
> data submitted through a CGI from a HTML form to be usable in other
pages.
>
> Many thanks for the anticipated help guys
>
> Sharriff Aina
> med.iq information & quality in healthcare AG