At 4:37 PM -0500 1/19/04, Uri Guttman wrote:
>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:

DS> =item All shared PMCs must have a threadsafe vtable

  DS> The first thing that any vtable function of a shared PMC must do is to
  DS> aquire the mutex of the PMCs in its parameter list, in ascending
  DS> address order. When the mutexes are released they are not required to
  DS> be released in any order.

why the ascending address order to grab mutexes? is this to help solve
deadlocks?

Yes. The recommendation I've always seen for deadlock avoidance is to always have all your code grab its mutexes in some fixed order. With source, it's generally recommended that you grab mutex variables in lexical order. Since we're all binary we need a different order, and ascending addresses are reasonably simple to do.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to