Forgot to mention that I know about Dossy's comment in the wiki that nsv_incr can be used to this effect, and I'm doing that.
http://panoptic.com/wiki/aolserver/Nsv_incr

but I was wondering why "try" wasn't part of ns_mutex when the C code is there for it.

-john



On Feb 22, 2007, at 3:09 pm, John Buckman wrote:

I'm looking to have mutexes with timeouts, and I see support in the C code for this but none carried over to Tcl.

In the C code, there's a Ns_MutexTryLock() function, but no tcl function for calling it.

Ns_MutexLock calls Ns_MutexTryLock() and there appears to be timeout support:
    if (!NsLockTry(mutexPtr->lock)) {
        return NS_TIMEOUT;
    }

but I don't see any way of setting the mutex timeout seconds.

It's trivially simple to modify NsTclMutexObjCmd (in tclthread.c) to support "ns_mutex try" and I'm wondering if there's a reason this hasn't been done.



--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to