Commit Graph

144 Commits

Author SHA1 Message Date
Max Kellermann cc511e7b60 event/IdleMonitor: new monitor class 2013-08-10 11:52:31 +02:00
Max Kellermann bb2af791e9 event/MultiSocketMonitor: add struct SingleFD
Prepare for migrating away from GLib.
2013-08-10 11:52:31 +02:00
Max Kellermann f3f4b332ae event/MultiSocketMonitor: use uint64_t instead of gint64
Unsigned and portable.
2013-08-10 11:52:31 +02:00
Max Kellermann 84ac79bb08 event/MultiSocketMonitor: eliminate virtual method CheckSockets()
Handle timeout internally.
2013-08-10 11:52:31 +02:00
Max Kellermann be0c8495cd event/MultiSocketMonitor: PrepareSockets() returns timeout
Simplify the API, don't use GLib specific integer type.
2013-08-10 11:52:31 +02:00
Max Kellermann d23c907a94 thread/Id: new class replacing GThread pointers
Remove a GLib dependencies from class EventLoop and DatabaseLock.
2013-08-10 09:00:04 +02:00
Max Kellermann 018f4155eb event: add function BlockingCall()
Replaces io_thread_call().  This approach is more generic and easier
to use due to std::function.
2013-08-08 23:04:07 +02:00
Max Kellermann 9ab0a1f5f1 EventLoop: add methodd IsInside()
Track which thread runs the EventLoop and provide a check whether
we're currently inside.
2013-08-08 23:04:01 +02:00
Max Kellermann c043b337b1 EventLoop: un-inline Run() and others
Prepare for adding more code.
2013-08-08 23:03:49 +02:00
Max Kellermann 090bc6fa79 event/*Monitor: add method GetEventLoop() 2013-08-08 23:03:38 +02:00
Max Kellermann b63db1c1aa event/SocketMonitor: un-inline Schedule()
Merge with CommitEventFlags().
2013-08-08 00:18:59 +02:00
Max Kellermann 0287ac794e event/SocketMonitor: add assertions 2013-08-08 00:18:59 +02:00
Max Kellermann 377b6f05ea event/BufferedSocket: add missing include 2013-08-08 00:11:40 +02:00
Max Kellermann f6f4742410 event/DeferredMonitor: rename Run() to RunDeferred() 2013-08-07 19:39:26 +02:00
Max Kellermann 977004c350 event/DeferredMonitor: use EventLoop::AddIdle() 2013-08-07 19:38:10 +02:00
Max Kellermann 355dd5cb24 event/DeferredMonitor: new class wrapping g_idle_add() 2013-08-07 18:59:42 +02:00
Max Kellermann f2ce8c3b62 event/EventFD: move to libsystem 2013-08-07 11:52:26 +02:00
Max Kellermann 4223657ab8 event/SignalMonitor: use signalfd() if available 2013-08-07 11:03:47 +02:00
Max Kellermann 930128a7ea SignalHandlers: move code to new class SignalMonitor 2013-08-07 10:56:33 +02:00
Max Kellermann db447440ff event/Event{Pipe,FD}: auto-create in constructor
Errors are fatal now.  This makes the class a lot easier to use.
2013-08-07 10:53:22 +02:00
Max Kellermann b70d38dc10 Makefile.am: move sources to libsystem.a 2013-08-07 10:31:31 +02:00
Max Kellermann 47e16dbee3 configure.ac: add option --enable-eventfd
Remove the runtime check for eventfd(), hard-code the feature once
it's been selected at compile time.  The class WakeFD is splitted into
EventFD and EventPipe, using WakeFD as a macro diversion.
2013-08-06 23:32:21 +02:00
Max Kellermann 98cbc0ea79 event/TimeoutMonitor: eliminate support for periodic events
No caller needs this.  Fixes use-after-free after returning from
Client::OnTimeout().
2013-04-08 23:14:07 +02:00
Max Kellermann 5692e20fd5 event/ServerSocket: close only sockets that have been opened
Fixes assertion failure.
2013-02-04 11:44:36 +01:00
Uli Schlachter a4223aac38 ServerSocket: Initialize length variable 2013-02-04 09:30:21 +01:00
Max Kellermann be3d2188d6 event/SocketMonitor: wake up the event loop after flag change 2013-01-30 15:08:09 +01:00
Max Kellermann 18e429a87e event/Loop: add method WakeUp() 2013-01-30 15:08:09 +01:00
Max Kellermann 18c4b536f2 event/ServerSocket: add method GetEventLoop() 2013-01-30 14:23:01 +01:00
Max Kellermann fa51db449f ServerSocket: replace callback with virtual method 2013-01-30 14:16:04 +01:00
Max Kellermann ad5eb2f8d6 ServerSocket: expose the class
Eliminate the C wrappers.
2013-01-30 13:40:56 +01:00
Max Kellermann 39d56d6b65 ServerSocket: move to libevent.a 2013-01-30 13:39:12 +01:00
Max Kellermann a291415326 event/BufferedSocket: move output buffer to FullyBufferedSocket
BufferedSocket has just an input buffer, and FullyBufferedSocket adds
the output buffer.
2013-01-30 11:03:44 +01:00
Max Kellermann 4ad7456428 event/SocketMonitor: OnSocketReady() returns bool 2013-01-30 11:03:44 +01:00
Max Kellermann 73f36858bb event/SocketMonitor: add methods Read(), Write() 2013-01-30 10:39:17 +01:00
Max Kellermann 20f85745e7 require GLib 2.24 2013-01-29 18:33:37 +01:00
Max Kellermann 068f191c0d event/SocketMonitor: add method Steal() 2013-01-27 22:38:14 +01:00
Max Kellermann a0ebd444ad event/SocketMonitor: add method Open()
Allow creating a closed SocketMonitor instance.
2013-01-15 22:56:06 +01:00
Max Kellermann 083065f433 input/Curl: move code to class MultiSocketMonitor 2013-01-15 18:16:55 +01:00
Max Kellermann 396480cf94 event/SocketMonitor: wrapper class for GSource + GPollFD 2013-01-15 11:00:48 +01:00
Max Kellermann d3a479b7fa event/TimeoutMonitor: wrapper for g_timeout_source_new() 2013-01-14 11:12:28 +01:00
Max Kellermann e83f805b8f Main, IOThread: move GMainLoop setup code to class EventLoop 2013-01-14 09:15:49 +01:00
Denis Krjuchkov 90ab65f8c7 WakeFD.cxx: use two sockets instead of pipe on Win32
Pipes aren't really pollable on Windows.
GLib emulates polling on pipes using separate reader/writer threads.
This adds significant overhead and keeps a strong dependency on GLib.

socketpair() function is absent on Windows as well.
We implement it here in a loose way.
2013-01-13 15:30:53 +06:00
Max Kellermann ecd5eb02c5 event/WakeFD: use eventfd() if available 2013-01-10 00:10:01 +01:00
Max Kellermann a93caf3cfe GlobalEvents: move code to class WakeFD 2013-01-09 23:47:38 +01:00