Re: [Libevent-users] multithreading problem

2013-01-08 Thread Nir Soffer
On Jan 8, 2013, at 12:55 AM, Björn K. wrote: > That piece of code should distribute the incoming connections over the > threads (I want to change that code later to select the thread with > the lowest number of handled connections). If I don't use this code > and use instead > bev = bufferevent_o

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Björn K .
The posted code compiles on my machine without modifications. Thus I wonder why you have to do some cleanup. But the example code fails silently. Perhaps you don't run it with enough rights to bind to port 443? Most of the time I access the server with a browser and keep the reload button pressed.

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Filipe Miguel Campos Santos
Hey Björn, multithreading and libevent is a bit tricky (at least it was for me). I would also suggest to change your design... I developed a multithreaded websocket server based on libevent a year ago: My approach was to create a single event base per thread. Each event base in each thread listen

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Filipe Miguel Campos Santos
Hey Björn, multithreading and libevent is a bit tricky (at least it was for me). I would also suggest to change your design... I developed a multithreaded websocket server based on libevent a year ago: My approach was to create a single event base per thread. Each event base in each thread listen

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Nir Soffer
On Tue, Jan 8, 2013 at 12:30 PM, Björn K. wrote: > The posted code compiles on my machine without modifications. Thus I > wonder why you have to do some cleanup. > Maybe because I run with older system (10.6). > But the example code fails silently. Perhaps you don't run it with > enough rights

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Mark Ellzey
On Tue, Jan 08, 2013 at 11:30:00AM +0100, Bj?rn K. wrote: > The posted code compiles on my machine without modifications. Thus I > wonder why you have to do some cleanup. > But the example code fails silently. Perhaps you don't run it with > enough rights to bind to port 443? > > Most of the time

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Mark Ellzey
On Mon, Jan 07, 2013 at 11:55:04PM +0100, Bj?rn K. wrote: > That piece of code should distribute the incoming connections over the > threads (I want to change that code later to select the thread with > the lowest number of handled connections). If I don't use this code > and use instead > bev = bu

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Björn K .
This is the valgrind --tool=helgrind output. The first part appears for every connection to the server: ==5477== Possible data race during write of size 4 at 0x602707c by thread #1 ==5477==at 0x412DFC: bufferevent_incref_and_lock_ (bufferevent.c:653) ==5477==by 0x412E4F: bufferevent_enable

Re: [Libevent-users] multithreading problem

2013-01-08 Thread Björn K .
I misunderstood the way how your code works. After rereading it, I think I will use it in my program. Thanks. 2013/1/8 Mark Ellzey : > On Tue, Jan 08, 2013 at 11:30:00AM +0100, Bj?rn K. wrote: >> The posted code compiles on my machine without modifications. Thus I >> wonder why you have to do some