Use of "fast" mutexes in mupdate.c
Dave McMurtrie
dave64 at andrew.cmu.edu
Mon Mar 30 14:01:11 EDT 2009
Wesley Craig wrote:
> On 30 Mar 2009, at 08:52, Dave McMurtrie wrote:
>> I was reading through the mupdate.c code this morning looking for a
>> solution to a problem we're experiencing.
>
> What problem is that?
>
sigsegv received at the prot_printf below in mupdate.c. C->pout was an
invalid address.
pthread_mutex_lock(&idle_connlist_mutex); /* LOCK */
for(C=idle_connlist; C; C=C->next_idle) {
prot_printf(C->pout,
"* BYE \"no longer ready for
connections\"\r\n");
> In properly written code, all of the threads are working together.
> Thus, while any thread is free to (incorrectly) unlock a critical mutex
> that they have no business messing with, in properly written code, they
> don't. That would be a bug.
You're saying that as long as no other thread ever calls
pthread_mutex_unlock() without having already acquired the lock, this
could never happen, right? Makes sense.
> So, in summary, if using PTHREAD_MUTEX_ERRORCHECK is going to help you
> track down whatever problem you're having, you should definitely use it.
This isn't directly related to the problem we're having. The second
e-mail I sent about mupdate this morning is. In trying to track down
that problem, I found a core file that led me to wonder what had stomped
on C->pout.
Thanks for the feedback. That is helpful.
Dave
--
Dave McMurtrie, SPE
Email Systems Team Leader
Carnegie Mellon University,
Computing Services
More information about the Cyrus-devel
mailing list