[REBOL] Re: Multiuser database
From: petr::krenzelok::trz::cz at: 21-Mar-2006 19:38
Gabriele Santilli wrote:
>On Tuesday, March 21, 2006, 12:17:25 PM, you wrote:
>PK> uh, that all sounds crazy and because of what? Because unix can't
>PK> guarantee you file-lock if you particularly ask for it? What a weak
>PK> system ....
>Unix gives you a lock if you ask about a lock. But if you don't,
>then it doesn't - it's that simple.
OK, so why opening file under linux does not lock it automatically? I
would simply vote for such mechanism being available to rebol, if
possible and cross platform ... open/lock
>Locking is not a trivial issue, and that's why OS' provide
>semaphores and things like that natively.
If natively, it could be handled inside rebol then ....
>The best solution is always to have a single-threaded process
>providing serialized access to the given resource. When you can't
>do that, you are forced to deal with troubles.
how is that? we have semaphores, no? :-) Well, Windows gives me lock for
opened file, so no troubles here. Maybe Windows is weaker here, because
in contrast to unix, it actually probably can't open the file handle and
not lock it, as in rebol I found something like open/new %my-lock.lock
as sufficient ....
>A good solution that hasn't been mentioned so far is to use a TCP
>listen port as the lock. Two processes are (or at least should
>not) never allowed to listen to the same port.
;-) And I used this check just few hours ago, to check if some service
in OS is already running! Never thought about using it as a check for
locking ;-) I feel really dumb not to think of it for all those years :-)