We need mutexes in the event system

tridge at samba.org tridge at samba.org
Thu Aug 9 03:55:36 GMT 2007


Andrew,

 > This is my first attempt at adding in a mutex system - flawed, because
 > the second time we run across the mutex, we deadlock until we timeout.

yes, that does seem to be a bit of a flaw :-)

 > +	while (kerberos_mutex) {
 > +		DEBUG(5, ("Waiting on Kerberos mutex from %s\n", *kerberos_mutex));
 > +		event_loop_once(ev);
 > +		kerberos_mutex = talloc_get_type(event_context_application_data(ev),
 > +						 char const *);
 > +	};

this seems to be the problem. If we loop here, and the code which has
the lock is futher up the stack then we deadlock. It only works if the
code that has the mutex is fully async, and has returned to the main
event loop waiting for some packet to come in. 

If what you're trying to do is prevent the krb5 server from processing
two packets at once, then perhaps calling EVENT_FD_NOT_READABLE() on
the struct fd_event for the krb5 server is what you want? 

Cheers, Tridge


More information about the samba-technical mailing list