mutex_lock function and sasl_set_mutex
Devaraj Das
ddas at hortonworks.com
Sun Apr 16 16:24:36 EDT 2017
It seems to me that that's true. We should have the read/write to m->val within a critical section, otherwise this will be susceptible to race conditions.
________________________________
From: Cyrus-sasl <cyrus-sasl-bounces+ddas=hortonworks.com at lists.andrew.cmu.edu> on behalf of Ted Yu <yuzhihong at gmail.com>
Sent: Sunday, April 16, 2017 3:38 AM
To: W. Michael Petullo
Cc: cyrus-sasl at lists.andrew.cmu.edu
Subject: mutex_lock function and sasl_set_mutex
Hi,
Looking at sasl_set_mutex function shown in cyrus-sasl-2.1.26/utils/testsuite.c :
int my_mutex_lock(my_mutex_t *m)
{
if (m->val != 0)
{
fatal("Trying to lock a mutex already locked [single-threaded app]");
}
Wouldn't calling pthread_mutex_lock() better handle concurrent invocations of the mutex lock function ?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/cyrus-sasl/attachments/20170416/ced461ae/attachment.html>
More information about the Cyrus-sasl
mailing list