Questions tagged [libev]

A full-featured and high-performance event loop that is loosely modelled after libevent, but without its limitations and bugs. It is used, among others, in the GNU Virtual Private Ethernet and rxvt-unicode packages, and in the Deliantra MORPG Server and Client.

A full-featured and high-performance event loop that implements a reactor pattern and event-driven I/O in C. It is loosely modelled after libevent, but without its limitations and bugs

114 questions
4
votes
1 answer

Multithreaded socket server using libev

I'm implementing a socket server. All clients (up to 10k) are supposed to stay connected. Here's my current design: The main thread creates an event loop (use epoll by default) and a watcher for accepting clients. The accept callback Accept fd and…
rance.attack
  • 43
  • 1
  • 6
4
votes
2 answers

The data structure of libev watchers

Libev uses three data structures to storage different watchers. Heap: for watchers that sorted by time, such as ev_timer and ev_periodic. Linked list: such as ev_io, ev_signal, ev_child and etc. Array: such as ev_prepare, ev_check, ev_async and…
changchang
  • 549
  • 4
  • 11
3
votes
1 answer

C or C++ with libevent/libev: monitor a unix socket

I'm trying to monitor a unix socket ("/tmp/mysocket"). I can do this fine in Node.js: it raises an event when a socket is bound someone connects to the socket data is sent to the socket and the socket is disconnected. I'm trying to now do this in…
Eamorr
  • 9,872
  • 34
  • 125
  • 209
3
votes
2 answers

Hiredis, libev and boost:threads

Trying to write a simple Redis client using hiredis and libev libraries. Everything is going well, except stopping event loop - m_thread.join() just stuck. Moving all initializing stuff to the newly created thread does nothing. Here is part of my…
3
votes
1 answer

100% CPU usage with libev

I have a tcp server which uses libev as an event loop; for new accepted sockets i set: ev_io_init(&conn->io, tcp_conn_on_event_cb, conn->fd, EV_READ | EV_WRITE); when a new connection is comming, my server consumes whole the CPU cycles, i have…
elhadi dp ıpɐɥןǝ
  • 4,763
  • 2
  • 30
  • 34
3
votes
2 answers

Can you prioritize events in libev?

Let's say I have 2 sockets I am watching for events and I really want socket 1 to be preferred (even at the cost of starving socket 2). How would I do that with libev (I asked the same question about libuv here but it looks like libuv cannot do…
Alex Garcia
  • 773
  • 7
  • 21
3
votes
1 answer

How to keep libev running even if all watchers are stopped

How to keep libev running even if all watchers are stopped?
CharlesLiuChina
  • 261
  • 1
  • 16
3
votes
1 answer

How to get new added files in a folder using Inotify along with libev?

My program (in C++) uses libev event loop. And I need to watch on a specific folder (say foo) for new files. I cannot use Inotify::WaitForEvents() in block mode because I do not want to block my libev event loop. As suggested in inotify…
Bo Tian
  • 277
  • 2
  • 6
3
votes
1 answer

Using synthetic filehandle with EV (perl)

I have a filehandle object that is created thus (edited slightly for clarity): sub TIEHANDLE { return $_[0] if ref($_[0]); my $class = shift; my $self = bless Symbol::gensym(), $class; return $self; } sub new { my ($class, $fh,…
awy
  • 5,271
  • 5
  • 23
  • 28
3
votes
1 answer

Can not join ev loop thread since it is hanging in epoll_wait()

I'm using async hiredis with libev. mLoopThread is used here for ev loop thread, basically mLoopThread is calling ev_loop(). when main thread tries to destruct async hiredis instance, it calls ev_unloop to try to make ev_loop() exit. The code looks…
JustDance
  • 61
  • 1
  • 5
3
votes
1 answer

libev custom events

I am trying to use libev for event based programming. But there are some events provided by libev like EV_READ, EV_WRITE, EV_TIMER .. So, is it possible to have an custom event of my own. For instance, I have a continuous flow of messages from a…
Chaitanya
  • 3,399
  • 6
  • 29
  • 47
3
votes
2 answers

sockets using libev

Iam looking to write a socket program based on libev. I noticed that several examples as stated in https://github.com/coolaj86/libev-examples/blob/master/src/unix-echo-server.c use the call backs based on init. For example, main()…
user2085689
  • 336
  • 3
  • 17
3
votes
1 answer

Receiving events in childs

I'm writing tcp server using libev. I'm creating socket and forking after listen(), then starting a libev read watcher on listening socket and receiving client connections in watcher callback. May it be situation, when both: child and parent (or …
user1940679
  • 176
  • 1
  • 11
2
votes
1 answer

Is there an easy way to wake up my program when a Vulkan fence is signalled?

I'm writing a program that uses libev to wait on many file descriptors. When data comes in, a vulkan compute shader gets run to process the data. The completion of that shader is signalled with a fence. I'd rather not block my event loop to wait for…
Woodrow Douglass
  • 2,605
  • 3
  • 25
  • 41
2
votes
1 answer

libev pass argument to callback

When we call ev_io_init we give it a function address that has (struct ev_loop*, struct ev_io, int) parameters but how we can make parameters like (struct ev_loop*, struct ev_io, int, void *ptr) and make ev_io_init call it with constant ptr value? I…