Commit Graph

513 Commits

Author SHA1 Message Date
Max Kellermann 5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann 2e182e84c3 thread/Mutex: remove ScopeLock, use std::lock_guard directly 2017-01-03 07:11:57 +01:00
Max Kellermann b042095ac2 event/Loop: use std::chrono 2016-12-28 01:15:08 +01:00
Max Kellermann 018c5ef731 event/Loop: use C++11 initializers 2016-12-27 23:13:26 +01:00
Max Kellermann e2b7c30811 event/BufferedSocket: pass std::exception_ptr to OnSocketError() 2016-11-02 10:38:05 +01:00
Max Kellermann aead221184 event/ServerSocket: migrate from class Error to C++ exceptions 2016-10-28 21:22:25 +02:00
Max Kellermann 63ab7767a3 event/Call: rethrow exceptions in calling thread 2016-09-09 18:14:21 +02:00
Max Kellermann ea0e6d9824 fs/FileSystem: RemoveFile() throws exception on error 2016-08-15 22:25:15 +02:00
Max Kellermann 22a353b8e3 event/SignalMonitor: fix obsolete nullptr check in SignalCallback() 2016-08-15 12:40:16 +02:00
Max Kellermann b67e7df38e release v0.19.17
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXgCv6AAoJECNuiljG20USR3cP/RALB4qlhecMo6H8VwZvfjiA
 FHfhBKfdpHM3U3EEIZc1zxwHIdWk1yELtmx298vmJbWUifpYAYarXF5497tZf2XE
 AVfhTltEJEd7xB5ZULnEScM1aHzMZm5HRcHwM1UqNCsXP7PT8fmpk7gw19pKOChT
 h8V3+tpC403lCIcHcJGlkuzgZvKIZDs73g7a0+4GxD9XRAPwnMYRl3Cfd8QjKT/U
 r67AcOwQlS6hWJFs0K1JjOQwfwbRq2YmuOmFJua6n8O6CI/7t4h3faSQ0V/5qjFd
 k/pAMRtX6mz3mjVhZv4cuMy+QILWlxUNwLBIwtxSfbwcFKrN0vtIRG8O9622hTs2
 +mvYiVboWABk6hnukiDAfki96jWYHlsCJR5oIK9DZ4nBe5RVp0r9Nq/ook2AW2it
 6VgYIDBI5zS/blyJzXtzDVWEtSmLFxm21JSl+jHfWDtL6/rQGimdVOFkRw40oCBz
 seYb5kIbilrg6xq1KiBMT+EWmXMf+q+3YWQsu01blXGYGPhpUqhIr0h/qUfWAqMs
 fwIsoxsTrkQQjEWb6YWupPrdOLZ+kTAyaK+7v8B8JmzS/H3SohusMPUZKsQXl82s
 5LJVLtVxB9WRRmpfSoYqfk7CkTHOktCzVmiHb/FYUYElS9VKmJYYU8XQ25snCoZ6
 bYtERsH28q8rrpkWWEXP
 =IXD5
 -----END PGP SIGNATURE-----

Merge tag 'v0.19.17'

release v0.19.17
2016-07-09 00:46:09 +02:00
Max Kellermann b46cf57d98 event/BufferedSocket: OnSocketReady() returns true after close
Fixes use-after-free bug (https://bugs.musicpd.org/view.php?id=4548).
2016-07-07 13:52:20 +02:00
Max Kellermann 3fd70a769a event/SignalMonitor: remove unused function SignalMonitorGetEventLoop 2016-06-20 10:48:34 +02:00
Max Kellermann 4280f84535 event/SignalMonitor: use BoundMethod instead of raw function pointer 2016-06-20 10:46:36 +02:00
Max Kellermann 829616534e event/DeferredCall: new class supposed to replace DeferredMonitor
Comes with a callback pointer instead of a virtual method, which
allows multiple instances in one class.
2016-06-17 18:26:29 +02:00
Max Kellermann 863f4d8366 util/BindMethod: new utility class for callbacks
Replaces the old BoundMethod template.
2016-06-17 18:20:19 +02:00
Max Kellermann 5ffe3773d4 event/MaskMonitor: add variant with bound method 2016-03-10 22:37:33 +01:00
Max Kellermann e52ac0b187 event/MaskMonitor: new class to replace code in GlobalEvents and Idle 2016-03-05 19:15:50 +01:00
Max Kellermann 1aee89f5ea *: include cleanup (using iwyu) 2016-03-01 22:08:13 +01:00
Max Kellermann 1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Anthony DeRossi de332a16d1 event/ServerSocket: fix AF_UNIX address in use error
bind fails with an "address already in use" error if the socket path
already exists.

This was broken by cbb595ba.
2015-09-30 21:50:34 +02:00
Max Kellermann cbb595ba83 event/ServerSocket: use AllocatedSocketAddress to build local socket address 2015-07-22 11:05:48 +02:00
Max Kellermann fdeec0307e event/ServerSocket: use AllocatedSocketAddress for OneServerSocket::address
Manages memory automatically.
2015-07-22 11:05:08 +02:00
Max Kellermann 7de0a621e3 net/StaticSocketAddress: replace cast operator with GetAddress()
The implicit cast operator can be very dangerous.
2015-07-22 10:55:57 +02:00
Max Kellermann 83752e9349 net/ToString: rename sockaddr_to_string() to ToString() 2015-07-22 10:26:18 +02:00
Max Kellermann 6f22452b54 net/Resolver: move sockaddr_to_string() to ToString.cxx 2015-07-22 10:03:36 +02:00
Max Kellermann b31d171ae8 *: doxygen fixups 2015-03-17 11:21:43 +01:00
Max Kellermann 5222c684d3 event/ServerSocket: #ifdef out local socket support on Windows 2015-03-05 10:07:07 +01:00
Max Kellermann 12de22d3bb net/StaticSocketAdress: new class wrapping struct sockaddr_storage 2015-02-13 21:16:43 +01:00
Max Kellermann 4e30e74739 net/SocketAddress: light wrapper for struct sockaddr 2015-02-10 22:06:06 +01:00
Max Kellermann 42890b9acf system/{Resolver,Socket{Error,Util}}: move to new library libnet.a 2015-02-10 22:06:06 +01:00
Max Kellermann 0cf57cc7ca event/ServerSocket: remove obsolete macro DEFAULT_PORT 2015-02-10 20:27:45 +01:00
Max Kellermann 68fcbaf4c8 event/ServerSocket: remove obsolete typedef 2015-02-10 20:24:23 +01:00
Max Kellermann 712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann adfc5db3d2 Merge branch 'v0.19.x' 2014-12-15 00:46:56 +01:00
Max Kellermann 3c29aa6271 event/Loop: read the "again" flag while holding mutex 2014-12-14 14:47:36 +01:00
Max Kellermann 88b75b57d0 playlist, InotifySource, ...: update GLib comments 2014-12-04 23:33:08 +01:00
Max Kellermann a8ebfd7a92 event/DeferredMonitor: include cleanup 2014-11-25 10:44:06 +01:00
Max Kellermann dc03f003ac release v0.18.18
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUa62OAAoJECNuiljG20US1CkP/3YaAg76hJDaeFAyi7/10lOs
 yI8tPmpQk8S+nuclsBJeIr+9xNRsjb1ebW4tI9uBRxqMT10SF7rMCH/qAmgnS9tQ
 6M48hF0o9xegjz4x5BosEJjXtiekYN068Xi/hk+H27guVy14f6Xx7oRpdr5oI/O0
 F83D1V2+vs6FuOyn42UQQNHVlYMac5SScHoSFomnwRYWI2wb2ay4H5Dlykb5BUl0
 tTjJ2lYwN18vUoMxjmCNS+bLd7jag6FZ/PXntB1zXe22R17eAIuFZAMKaQvnQtUi
 QZjFPhpd+mBsZLfokB3belyNNb4F6qSG2W6lZrFRB+SU/LqnY2AL/dxPJD9eiufs
 5jEIOw9hNBBKo217+hkPwp5pAF50u11tKXUXbKGeR42zAO0zll/+g2afVwoqdAfD
 llPDyQyXiB3tmA1bgJD7u9gaud3UaaXoxajPb5LnmklzGxiN5u1rnoo+E5ppBvQ4
 31wPHGpzsjxEC7Xn9hErPP17jYXY1HT/xRb8XZNrFqJVZxSyjqQlDWomhCWDcvPc
 Du1PyKaQ08zgElEM5trwC9RjJxQdr0sckQcTnYC/0ksfJ7Nhh8M2yepEI/gmWbnO
 JBQ7YzpQhE9oMMH8jzVLLdC44yF6QvXcGQ3D9eUfwvPk9Z70mHlNI3Q6kbZ76U5j
 RHLp+oSaxFUXfPdciZaw
 =GO+k
 -----END PGP SIGNATURE-----

Merge tag 'v0.18.18' into v0.19.x
2014-11-18 21:38:44 +01:00
Max Kellermann 3f5f96ac91 event/ServerSocket: fix get_remote_uid() error value
Must return -1 on error, not 0.  0 is root.
2014-11-18 20:53:59 +01:00
Max Kellermann a9c3ca8606 event/IdleMonitor: remove redundant comment 2014-10-10 22:39:11 +02:00
Max Kellermann c84508ae9f Merge branch 'v0.18.x' 2014-08-24 13:20:35 +02:00
Max Kellermann f06fe1ea98 event/TimeoutMonitor: really reset "active" flag before invoking OnTimeout()
The previous commit was broken.  D'oh!
2014-08-24 13:19:50 +02:00
Max Kellermann 77f2cd6513 Merge branch 'v0.18.x' 2014-08-24 13:15:17 +02:00
Max Kellermann d16fb79708 event/TimeoutMonitor: reset "active" flag before invoking OnTimeout()
The IsActive() method returned true even if the timer was not active,
after it completed once.  This broke the state file timer, and the
state file was not saved periodically.
2014-08-24 13:13:12 +02:00
Max Kellermann 8921b4f9d1 event/BufferedSocket: fix inversed buffer check
This was broken by commit 84d20d9e, which deleted the "!" from the
check.
2014-08-07 16:07:48 +02:00
Max Kellermann c3f111a56c event/BufferedSocket: fix inversed buffer check
This was broken by commit 84d20d9e, which deleted the "!" from the
check.
2014-08-07 16:03:44 +02:00
Max Kellermann ea26da0be7 util/FifoBuffer: rename to StaticFifoBuffer 2014-08-06 17:29:05 +02:00
Max Kellermann 0efb67b51e DeferredMonitor: fix race condition when using GLib event loop
Turns out the lock-free code using atomics was not thread-safe.  The
given callback could be invoked by GLib before the source_id attribute
was assigned.  This commit changes the DeferredMonitor class to use a
Mutex to block the event loop until source_id is assigned.  This bug
does not exist in the 0.19 branch because it does not use the GLib
main loop anymore.
2014-04-26 22:11:23 +02:00
Max Kellermann 7d353bbe2a configure.ac: always define _GNU_SOURCE on Linux
Make sure glibc gives us all features.
2014-03-15 18:27:09 +01:00
Max Kellermann 0102a8665a event/SignalMonitor: fix build failure due to missing signal.h include 2014-03-02 10:21:31 +01:00
Max Kellermann c32477a223 Merge branch 'v0.18.x' 2014-02-18 21:46:41 +01:00
Max Kellermann 5e1e92626c event/SignalMonitor: unblock signals after fork
Fixes hanging child process in the "pipe" output plugin.
2014-02-18 19:13:50 +01:00
Max Kellermann 4a28333039 event/Loop: remove the dummy constructor argument 2014-02-05 00:00:03 +01:00
Max Kellermann 4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann eb23ef1747 event/Loop: allow AddTimer() after Run() has returned
Kludge for libavahi-client quirk.
2014-01-09 20:56:00 +01:00
Max Kellermann 61b938d6fa event/Loop: allow scheduling events before Run()
Add the debug-only flag "virgin" which gets checked by assert()
calls.  Fixes assertion failures when using zeroconf/avahi.
2014-01-09 17:52:55 +01:00
Max Kellermann 27ca0db7a6 util/Alloc: new library replacing GLib's g_malloc() 2014-01-07 23:35:18 +01:00
Max Kellermann 582c2105a9 event/Loop: cancel the WakeFD monitor in destructor 2014-01-06 21:57:40 +01:00
Max Kellermann 08f5b9f1f9 event/MultiSocketMonitor: add method ClearSocketList() 2014-01-06 18:27:26 +01:00
Max Kellermann 793962c5b8 event/SocketMonitor: don't close the socket automatically
Users now have to call Close() explicitly.  This simplifies using the
class, as most users have automatic socket management already, and
Steal() had to be used often.
2014-01-06 18:26:55 +01:00
Max Kellermann 617090cfda event/IdleMonitor: cancel in destructor only if active
Debug-mode workaround for bogus assertion failure.
2014-01-06 18:21:45 +01:00
Max Kellermann a9e604d51d event/MultiSocketMonitor: API documentation 2014-01-06 08:59:27 +01:00
Max Kellermann e599b86424 event/Loop: try to avoid the WakeFD when adding DeferredMonitor
Add a flag that indicates whether the EventLoop is currently "busy".
As long as that flag is set, it does not need to be woken up - we can
simply add the DeferredMonitor to the list, and it will be caught by
EventLoop very soon.  This eliminates nearly all of the
DeferredMonitor overhead when compared to IdleMonitor, rendering
IdleMonitor mostly obsolete.
2014-01-05 02:15:34 +01:00
Max Kellermann da9e584921 event/Loop: combine multiple WakeFD::Write() calls
Reduce DeferredMonitor overhead.
2014-01-05 02:15:10 +01:00
Max Kellermann e9d764d7ad event/Loop: add attribute "again"
Improved support for added events.
2014-01-05 02:15:01 +01:00
Max Kellermann 6268955778 event/Loop: add thread-safety assertions 2014-01-05 02:14:31 +01:00
Max Kellermann c12da599b9 event/Loop: remove obsolete assertion 2014-01-05 01:41:03 +01:00
Max Kellermann f685a48008 event/Loop: move code to HandleDeferred() 2014-01-05 01:35:12 +01:00
Max Kellermann 7c15e41da5 event/MultiSocketMonitor: add missing <algorithm> include
For std::find_if().
2014-01-05 01:35:12 +01:00
Max Kellermann 7b540f0226 event/MultiSocketMonitor: add method ReplaceSocketList()
Move code from AlsaMixerPlugin.
2014-01-05 01:28:36 +01:00
Max Kellermann e29c22e662 event/MultiSocketMonitor: include cleanup 2014-01-05 00:39:29 +01:00
Max Kellermann f0d3b47ad8 event/Loop: remove the GLib implementation
Now that the remaining known bugs in poll() implementation are fixed,
we can go on without the GLib implementation.
2014-01-04 19:31:23 +01:00
Max Kellermann 880bf17dae event/poll: eliminate one vector::size() call 2014-01-04 19:10:21 +01:00
Max Kellermann 19424e95db event/Loop: remove bogus "!quit" assertion
Commit 1f11959 allowed modifying the "quit" attribute from any thread,
and thus the assertion may fail spuriously.  This assertion is too
strict for the relaxed use of "quit".  Let's remove it and move the
"quit" check to before the SockedMonitor::Dispatch() call.
2014-01-04 17:06:05 +01:00
Max Kellermann 0f9ef2506f event/Loop: remove unused method AddCall() 2014-01-04 16:00:45 +01:00
Max Kellermann 1f1195975f event/Loop: non-recursive Break() implementation
Simply set the "quit" flag and wake up the thread.  This works even if
we're inside this thread.  Setting "quit" to a new value without mutex
protection is usually not safe, but good enough here.
2014-01-04 15:59:00 +01:00
Max Kellermann d2a4f64fd6 event/BlockingCall: always use DeferredMonitor internally
There is no advantage of using EventLoop::AddCall(), now that
DeferredMonitor is thread-safe.
2014-01-04 15:58:59 +01:00
Max Kellermann a357d84dce event/DeferredMonitor: make fully thread-safe
Instead of creating a new eventfd for each DeferredMonitor instance,
reuse EventLoop's eventfd, and add a std::list to EventLoop that
manages the list of pending DeferredMonitors.  This std::list is
protected by the same mutex as the "calls" list.

The bottom line is: reduced overhead because the per-instance eventfd
was eliminated, slightly added overhead due to Mutex usage (but
negligible), and we're thread-safe now.

This subsystem is now good enough to replace EventLoop::AddCall().
2014-01-04 15:58:59 +01:00
Max Kellermann e73d0df2b6 event/*Monitor: document as not being thread-safe 2013-12-31 15:59:41 +01:00
Max Kellermann af3f483924 event/Loop: document that AddCall() is thread-safe 2013-12-31 15:31:59 +01:00
Max Kellermann 6416198e9f event/PollGroupPoll: include stddef.h instead of string.h 2013-12-21 21:21:25 +01:00
Max Kellermann d86cd4e4b4 util/fifo_buffer: remove obsolete library 2013-12-19 12:17:09 +01:00
Max Kellermann 52dca859c7 util/PeakBuffer: use IsEmpty() instead of IsNull()
The DynamicFifoBuffer methods never return nullptr when the buffer is
empty or full; instead, they return an empty buffer.  This bug caused
an endless loop.
2013-12-19 10:30:26 +01:00
Max Kellermann ecdebb315f util/PeakBuffer: use DynamicFifoBuffer instead of struct fifo_buffer
Switch to the C++ version.
2013-12-15 23:07:08 +01:00
Max Kellermann 1f523be72d util/PeakBuffer: return ConstBuffer<void> 2013-12-15 23:07:08 +01:00
Max Kellermann d5dfe7d457 configure.ac: add option "--disable-glib"
Allows building without GLib.  This fails to compile currently,
because GLib is still used in the MPD core.
2013-12-15 18:43:12 +01:00
Max Kellermann e1901e97c2 system/Resolver: sockaddr_to_string() returns std::string()
No GLib memory allocation.
2013-12-04 08:43:55 +01:00
Denis Krjuchkov 07352e82f1 PollGroupWinSelect: delete copy constructor and assignment operator 2013-12-03 11:43:26 +06:00
Denis Krjuchkov 1003cc9bf9 PollGroupWinSelect: uninline constructor and destructor 2013-12-03 11:41:36 +06:00
Denis Krjuchkov 1df426aa5c event: add poll() based PollGroup implementation 2013-12-02 14:39:52 +06:00
Denis Krjuchkov 71bc15aca1 PollGroupEPoll.hxx: add const modifiers where applicable 2013-11-29 15:26:57 +06:00
Denis Krjuchkov cfdd5edc49 event: implement PollGroup based on Windows select 2013-11-29 15:05:01 +06:00
Denis Krjuchkov bb288f0284 event: introduce generic API for internal event loop 2013-11-28 17:06:16 +06:00
Max Kellermann f90abe9530 include cleanup using iwyu 2013-11-28 11:50:54 +01:00
Denis Krjuchkov 46bab7e4b9 Add infrastructure for using multiple event loops
This change adds two configuration options:

  --with-eventloop=[glib|internal|auto]
  --with-pollmethod=[epoll|auto]

First allows switching between GLib event loop and internal one.
Second chooses backend to use for internal event loop.
Conditional compilation symbols are changed accordingly.
Additional helper macro MPD_OPTIONAL_FUNC_NODEF is added as well.
2013-11-27 17:28:36 +06:00
Max Kellermann e53a25cbae event: add API documentation 2013-11-24 19:28:04 +01:00
Max Kellermann 41e7145973 event/SocketMonitor: add missing space 2013-11-24 16:07:12 +01:00
Max Kellermann 5c18e4f114 event/FullyBufferedSocket: remove obsolete TODO comment
We have a better solution now.
2013-11-06 23:50:36 +01:00
Max Kellermann 422b8472fe event/FullyBufferedSocket: try to write without extra roundtrip
Postpone the write using IdleMonitor instead of scheduling a write
event.  This reduces the number of system calls, because we don't need
to register and unregister the write event in epoll.
2013-11-06 21:52:24 +01:00
Max Kellermann 5b213b0504 event/FullyBufferedSocket: make WriteFromBuffer() protected
.. and rename it to Flush().
2013-11-06 21:52:09 +01:00
Max Kellermann 154bdf0bca event/SocketMonitor: add method Abandon() 2013-11-06 19:05:45 +01:00
Max Kellermann 7bca61f5bb event/ServerSocket: don't abort if IPv6 is not available
First check if an IPv6 socket can be created.
2013-11-04 23:36:02 +01:00
Max Kellermann b54762a8f6 event/ServerSocket: fix assertion failure
Regression from previous commit.  D'oh!
2013-11-04 20:16:28 +01:00
Max Kellermann bcae86196c event/ServerSocket: open sockets in the order they were configured
Use a std::list which can be appended at the end.
2013-11-04 20:10:46 +01:00
Max Kellermann 20597b3632 *: use nullptr instead of NULL 2013-10-28 23:58:17 +01:00
Max Kellermann 3274bb54ad event/ServerSocket: pass AllocatedPath to AddPath() 2013-10-19 17:40:56 +02:00
Max Kellermann 43863a70c8 SignalMonitor: add SignalMonitorGetEventLoop()
Eliminate the global variable "shutdown_loop".
2013-10-18 08:44:40 +02:00
Max Kellermann 12ab556477 event/BufferedSocket: pass writable pointer to OnSocketInput()
Remove the const_cast from HttpdClient.cxx, and avoid one allocation
in ClientRead.cxx.
2013-10-15 22:47:46 +02:00
Max Kellermann 84d20d9e43 util/FifoBuffer: C++ version of the fifo_buffer library 2013-10-15 10:28:52 +02:00
Max Kellermann 0c13703da3 system/clock: convert to C++ 2013-10-15 09:38:12 +02:00
Max Kellermann b97b7a7493 require GLib 2.28
The header glib_compat.h is now obsolete and can be removed.
2013-10-15 09:35:25 +02:00
Max Kellermann be2951b45f gcc.h: rename to Compiler.h 2013-10-15 09:21:59 +02:00
Max Kellermann 060814daa8 Log: new logging library API
Prepare to migrate away from GLib.  Currently, we're still using GLib
as a backend.
2013-10-02 08:57:55 +02:00
Max Kellermann ee9e238179 system/SocketError: un-inline constructor
Reduces header dependencies.
2013-09-04 23:36:30 +02:00
Max Kellermann 29030b54c9 util/Error: new error passing library
Replaces GLib's GError.
2013-09-04 18:14:22 +02:00
Max Kellermann c9fcc7f148 system/resolver: convert to C++ 2013-09-04 18:02:09 +02:00
Max Kellermann 00420ef9ca EventLoop: initialise the thread id explicitly 2013-08-10 14:01:55 +02:00
Max Kellermann c1f4f1fdb6 EventLoop: new implementation using epoll
Implement an event loop without GLib.
2013-08-10 13:54:23 +02:00
Max Kellermann 94cdc47786 event/Call: signal the calling thread
Fixes regression from commit 018f4155.
2013-08-10 12:40:44 +02:00
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