The function xdmp:aquire-lock writes a new fragment to represent the lock. I wouldn't use it as a semaphore.
Instead, try http://developer.marklogic.com/pubs/4.2/apidocs/UpdateBuiltins.html#xdmp:lock-for-update. Note that it can be a network operation, if multiple forests on multiple hosts are assigned to the database. Also note that your query is now an update operation. So it will no longer run in timestamped mode, and all document accesses will use read locks. -- Mike On 25 May 2011, at 15:51 , Keith Breinholt wrote: > Does xdmp:aquire-lock( $url, ‘exclusive’) acquire a physical lock (disk > write) on a file or is a memory operation? > > I’ve been looking for a way to create a semaphore in XQuery. Using a > document and acquiring a lock achieves that goal but if it acquiring the lock > is a physical lock it will require approximately 4 to 8 milliseconds to > acquire and a similar amount of time to release. Which translates to 8-16 > milliseconds for a semaphore style operation. > > I’m assuming xdmp:acquire-lock() uses a memory operation, but I need to know. > > -- > Keith > "Do what you can, with what you have, where you are." - Theodore Roosevelt > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
