Questions tagged [libevent]

libevent is an API for writing event driven systems. libevent is written in C and should compile on Linux, *BSD, Mac OS X, Solaris and Windows.

From the Homepage: Libevent

libevent is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop.

Currently, libevent supports /dev/poll, kqueue(2), event ports, select(2), poll(2) and epoll(4). The internal event mechanism is completely independent of the exposed event API, and a simple update of libevent can provide new functionality without having to redesign the applications. As a result, Libevent allows for portable application development and provides the most scalable event notification mechanism available on an operating system. Libevent can also be used for multi-threaded applications; see Steven Grimm's explanation. Libevent should compile on Linux, *BSD, Mac OS X, Solaris and Windows.

368 questions
3
votes
1 answer

How do I write unit tests for an event driven application managed by libevent?

I'm writing an event driven application using the libevent library for asynchronous I/O. Essentially, the application has an evconnlistener listening for data on a port. On receiving data, the data is forwarded to a corresponding http REST end point…
sanjivr
  • 991
  • 8
  • 12
3
votes
2 answers

Callback to member function using libevent

I am trying to pass a member function to libevent which should be treated as a callback. #include class A { public: void eventcb(evutil_socket_t fd, short events, void *ctx) { } }; static void global_eventcb(evutil_socket_t…
Alexander Olsson
  • 1,908
  • 1
  • 15
  • 24
3
votes
1 answer

can anyone explain to me how bufferevent ( in libevent) works for non-blocking sockets?

The documentation for libevent 2.0 isn't easy to understand. Can anyone point me to a tutorial?
BeeBand
  • 10,953
  • 19
  • 61
  • 83
3
votes
0 answers

comparing livuv, libevent or other implementations

We are currently using epoll based implementation on Linux. We plan to port our software to mac and hence looking for platform independent approach. I looked at libevent2 and libuv, both seem to be fitting our requirement. However, I would like to…
Rahul
  • 390
  • 4
  • 14
3
votes
0 answers

MPI and libevent mixed code causes Segmentation fault on Ubuntu

I have a simple C program reproduces a recent problem I encountered. /* filename: a.c */ #include #include int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); event_init(); MPI_Finalize(); } The…
Wei Zhong
  • 580
  • 10
  • 17
3
votes
1 answer

How to use libusb with libevent?

I'm writing an event-driven application using libevent, and I need to do a USB transfer using libusb-1.0. I wanted to use libusb_get_pollfds to get a list of files descriptors (in fds) and add them to libevent like this: const struct libusb_pollfd…
Pawel Zubrycki
  • 2,703
  • 17
  • 26
3
votes
1 answer

Error while loading shared libraries: libevent-2.0.so.5

After upgrade ubuntu 16 to 18. I got this error when execute tmux tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory and here's result when I execute ldd $(which…
Sastra Nababan
  • 154
  • 2
  • 8
3
votes
2 answers

how can I reduce cpu usage in a golang tcp server?

I try to implement a golang tcp server, and I found the concurrency is satisfied for me, but the CPU usage is too high(concurrency is 15W+/s, but the CPU usage is about 800% in a 24 cores linux machine). At the same time, a C++ tcp server is only…
E.SHEN
  • 39
  • 1
  • 5
3
votes
3 answers

How to install PgBouncer on Windows 7 (x64)

I am attempting to install PgBouncer on my computer with no success. In the installation page, im told that PgBouncer has two dependencies GNU Make 3.81+ and libevent 2.0. Never having used or heard of these two software before, Im completely…
Hozeis
  • 1,542
  • 15
  • 36
3
votes
3 answers

how to install c++ library libuv on OS X?

i want to install libuv on OS X,but when i brew install libuv then i write a simple demo : #include #include int main() { uv_loop_t *loop = uv_loop_new(); printf(“Now quitting.\n”); uv_run(loop, UV_RUN_DEFAULT); …
Leviathan
  • 335
  • 2
  • 5
  • 10
3
votes
2 answers

Memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file

Situation: I installed memcached on a CenTOS 5 (64 bit). I also ended up installing some PHP plugins using PECL, though they're unnecessary now. Problem:When I execute /etc/init.d/memcached start I get the following error: Starting memcached:…
Abhishek
  • 743
  • 1
  • 15
  • 28
3
votes
1 answer

CMake 'no rule to make target' with external library

I am trying link one of my programs to libevent. I am using CMake as build system. My project structure is as follows: my_project ├── CMakeLists.txt ├── README.md ├── build │  └── Build stuff └── software ├── README.md ├── CMakeLists.txt …
Faas
  • 417
  • 1
  • 4
  • 14
3
votes
0 answers

How to install libevent on Windows?

I'm using Ratchet on Windows Server 2012. I'd like to have Ratchet use libevent. I have completed the following two things: Using MinGW, I built libevent from source and got three DLLs:…
Boyan Georgiev
  • 1,521
  • 2
  • 13
  • 16
3
votes
2 answers

OpenSSL SSL_shutdown received signal SIGPIPE, Broken pipe

I'm writing a http/https client using openssl-0.9.8e I get error when I call SSL_read() then, I call SSL_get_error get SSL_ERROR_SYSCALL and errno ECONNRESET 104 /* Connection reset by peer */ accoring to SSL documetation that's what it…
user3282867
  • 51
  • 1
  • 3
3
votes
0 answers

Libevent: multithreading to handle HTTP keep-alive connections

I am writing an HTTP reverse-proxy in C using Libevent and I would like to implement multithreading to make use of all available CPU cores. I had a look at this example:…
SlappyTheFish
  • 2,344
  • 3
  • 34
  • 41