Re: Patch for libeio

2012-03-06 Thread Pierre-Yves Kerembellec
>> - remove trailing commas in enums in eio.h (since C++ does not allow them). > > Hmm, libeio is C, not C++, but even C++ does allow trailing commans in > enums, see 7.2p1: > > enum-specifier: >enum-head { enumerator-list(opt) } >enum-head { enumerator-list , } But it can be u

Patch for libeio

2012-03-06 Thread Pierre-Yves Kerembellec
Hi, Please find here: http://paste.pocoo.org/raw/561723/ a patch against the current version of libeio. This patch addresses 2 things (mainly linked to ease of use in C++): - remove trailing commas in enums in eio.h (since C++ does not allow them). - add an opaque applicative pointer in eio_ini

Re: Issue with reading data on socket

2011-10-12 Thread Pierre-Yves Kerembellec
Le 13 oct. 2011 à 08:12, sai koushik a écrit : > Hi , > > i tried to crate a socket client using libev , and this client has to listen > for data from the server. > and i tried as below > ev_io stdin_watcher; > > sock_fd = socket(PF_UNIX, SOCK_STREAM, 0); >

Re: 60K+ spurious notification per second?

2011-06-20 Thread Pierre-Yves Kerembellec
> Thanks Pierre-Yves! > I modified my code setting non-blocking socket using the way you described. > The problem is still the same. You need to listen(fd, backlog) on your server socket before attempting to connect. How about something like this: #include #include #include #include int se

Re: Best libev way to write in a socket

2011-06-20 Thread Pierre-Yves Kerembellec
> Well, I've just found out why the "Invalid file descriptor" was generated. I > didn't stop the "read watcher" when creating the "write watcher". > > So, I just maintain my second question: > What's the most convenient way to write data in a TCP socket: > 1.- "send" data directly in the read

Re: 60K+ spurious notification per second?

2011-06-17 Thread Pierre-Yves Kerembellec
Hi Cong, > I'm a newbie to libev. I wrote a TCP server with libev. My program has a > relatively simple structure, with accept_cb, read_cb, write_cb and timeout_cb > defined. However, when I started it, I found the accept call back is called > right away and being called about 60K+ times per se

Re: Better way to timeout connect() when using libev?

2011-05-18 Thread Pierre-Yves Kerembellec
> We use libev in Linux (2.6.35 on big/small endian ARM) for a simple > network client application where we want to timeout connect() attempts. > > http://www.unixguide.net/network/socketfaq/3.5.shtml > > For this purpose we use the following construct in a libev callback. > >timeo

Re: Using libev with pthreads and one listening socket

2011-03-30 Thread Pierre-Yves KEREMBELLEC
> On Wed, Mar 30, 2011 at 03:27:04PM +1100, Arlen Cuss > wrote: >> I enjoyed reading your (many) comments in the documentation talking >> about the same :-P, particularly "a frankenpoll" re: epoll. > > It's a direct consequence of my many frustrated workarounds and insightful > moments ("ugh").

Re: Using libev with pthreads and one listening socket

2011-03-30 Thread Pierre-Yves Kerembellec
> On Wed, Mar 30, 2011 at 03:27:04PM +1100, Arlen Cuss > wrote: >> I enjoyed reading your (many) comments in the documentation talking >> about the same :-P, particularly "a frankenpoll" re: epoll. > > It's a direct consequence of my many frustrated workarounds and insightful > moments ("ugh").

Re: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-31 Thread Pierre-Yves Kerembellec
>> Thanks for the thorough explanation. I'm actually developing a fast socket >> server that will be using a storage backend library to store thousands of >> millions of "small objects" (basically less than 1K) in a large optimized >> hash table. This storage layer maintains a large objects cache

Re: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-31 Thread Pierre-Yves Kerembellec
> On Wed, Dec 30, 2009 at 03:26:03PM -0600, Brandon Black > wrote: >> What he's referring to is that in the general case, a multi-process >> program will scale better over increasingly large core counts than a >> multi-threaded program, because the shared address space of the >> threads tends to

Re: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-30 Thread Pierre-Yves Kerembellec
>> Thanks for your fast answer. If I correctly understand what you're saying, >> the same ev_async watcher started ev_async_init()-ed and ev_async_start()-ed >> in each worker thread has to be passed to the ev_async_send() call ? It >> means it cannot be a local variable anymore and has to be acc

Re: Re[2]: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-29 Thread Pierre-Yves Kerembellec
>> Your experience is interesting, but I have a question: why do you need >> threads in event-driven machine? I just tested my app based on libev, >> it works as followed: >> >> bind(); >> listen(); >> >> for (i = 0; i < 4; ++i) >> { >> switch (fork()) >> { >> case -1: /* epic fail */ break

Re: Re[2]: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-29 Thread Pierre-Yves Kerembellec
Hello Denis, > Your experience is interesting, but I have a question: why do you need > threads in event-driven machine? I just tested my app based on libev, > it works as followed: > > bind(); > listen(); > > for (i = 0; i < 4; ++i) > { >switch (fork()) >{ >case -1: /* epic fail */

Re: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-29 Thread Pierre-Yves Kerembellec
Hi Marc, Thanks for your fast answer. If I correctly understand what you're saying, the same ev_async watcher started ev_async_init()-ed and ev_async_start()-ed in each worker thread has to be passed to the ev_async_send() call ? It means it cannot be a local variable anymore and has to be acces

Re: ev_async_send() not trigerring corresponding async handler in target loop ?

2009-12-29 Thread Pierre-Yves Kerembellec
Hi list, I'm quite new to libev and I'm having a hard time figuring out why a call to ev_async_send() will not trigger the corresponding async handler in the specified target loop. I'm using the following exercizer program, where the main thread basically starts an event loop to monitor network