Nicolas Williams wrote:
On Sat, Sep 20, 2008 at 02:41:41PM +0200, Eric Leblond wrote:
Index: lib/common.c
===================================================================
RCS file: /cvs/src/sasl/lib/common.c,v
retrieving revision 1.116
diff -r1.116 common.c
154a155,161
/* only one call is permitted, if one of the function has already
* been changed we are in trouble in a subsequent call */
if ((_sasl_mutex_utils.alloc != &sasl_mutex_alloc) ||
(_sasl_mutex_utils.lock != &sasl_mutex_lock) ||
(_sasl_mutex_utils.unlock != &sasl_mutex_unlock) ||
(_sasl_mutex_utils.free != &sasl_mutex_free))
return;
Is there a need for a memory barrier? (A unified diff might have shown
enough context that I could tell.)
http://docs.sun.com/app/docs/doc/816-5168/membar-ops-3c?a=view
http://www.daemon-systems.org/man/membar_ops.3.html
(libatomic-ops for Linux?)
If we can do this is a crossplatform way (including Windows), that would
be helpful.
However sasl_set_mutex is not supposed to be called from multiple
threads (it is supposed to be called before the application starts
creating threads), so I wouldn't worry too much about this.