[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] multithreading problem
On Wed, Jan 09, 2013 at 11:22:43AM -0600, Mark Ellzey wrote:
> On Tue, Jan 08, 2013 at 11:29:01PM +0100, Bj?rn K. wrote:
> > This is the valgrind --tool=helgrind output. The first part appears
> > for every connection to the server:
> -- cut --
>
OK, you need to add a mutex around anything that uses "thread_base" and
"next_thread". I.e.,
pthread_mutex_lock(thread_base_lock);
next_thread = (next_thread + 1) % NUM_THREADS;
bufferevent_openssl_socket_new(thread_base[next_thread], ...);
pthread_mutex_unlock(thread_base_lock);
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.