<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<br>
Derrell Piper wrote:
<blockquote type="cite" cite="mid:m2wroddsee.fsf@electric-loft.org">
<blockquote type="cite">
<pre wrap="">(block got-lock
(loop
(dotimes (i *spin-lock-tries*)
(if (%store-conditional something somewhere)
(return-from got-lock t)))
(give-up-timeslice)))
</pre>
</blockquote>
<pre wrap=""><!---->
Not sure if this was pseudo-code or not, but...
A trick I've seen used is to do a non-interlocked test of the spinlock
before even trying the %store-conditional. </pre>
</blockquote>
You might want to check this out:<br>
<br>
<a href="http://en.wikipedia.org/wiki/Double-checked_locking" class="moz-txt-link-freetext">http://en.wikipedia.org/wiki/Double-checked_locking</a><br>
<br>
There are hazards here which might possibly be<br>
analogous to what you're doing, but I don't know.<br>
<blockquote type="cite" cite="mid:m2wroddsee.fsf@electric-loft.org">
<pre wrap=""> The non-interlocked test
will (mostly) avert the expensive %store-conditional when there's
spinlock contention. Depending upon your locking characteristics, this
can be a huge win. We used this in the VMS operating system where we
had a hierarchy of locks that had to be acquired in a particular order,
though it's applicable in the general case too.
Might be worth profiling...
Derrell
_______________________________________________
Openmcl-devel mailing list
<a href="mailto:Openmcl-devel@clozure.com" class="moz-txt-link-abbreviated">Openmcl-devel@clozure.com</a>
<a href="http://clozure.com/mailman/listinfo/openmcl-devel" class="moz-txt-link-freetext">http://clozure.com/mailman/listinfo/openmcl-devel</a>
</pre>
</blockquote>
</body>
</html>