aboutsummaryrefslogtreecommitdiffstats
path: root/src/event_pipe.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* copyright year 2011Max Kellermann2011-01-291-1/+1
|
* eliminate g_error() usageThomas Jansen2010-09-251-3/+4
| | | | | | | | | | | | | | Replaced all occurrences of g_error() with MPD_ERROR() located in a new header file 'mpd_error.h'. This macro uses g_critical() to print the error message and then exits gracefully in contrast to g_error() which would internally call abort() to produce a core dump. The macro name is distinctive and allows to find all places with dubious error handling. The long-term goal is to get rid of MPD_ERROR() altogether. To facilitate the eventual removal of this macro it was added in a new header file rather than to an existing header file. This fixes #2995 and #3007.
* main: Add Windows Service supportDenis Krjuchkov2010-09-231-0/+3
| | | | | | | | | I've added PIPE_EVENT_SHUTDOWN because calling g_main_loop_quit() do not work when called from another thread. Main thread was sleeping in g_poll() so I needed some way to wake it up. By some strange reason call close(event_pipe[0]) in event_pipe_deinit() hangs. In current implementation that code never reached so that was not a problem :-) I've added a conditional to leave event_pipe[0] open on Win32.
* event_pipe: use g_io_channel_read_chars() to drain the pipeMax Kellermann2010-05-191-6/+14
| | | | | | | For some unknown reason, read() blocks on WIN32, even though it was invoked inside the G_IO_IN callback. By switching to GIOChannel functions, this problem is solved, and it works on both Linux and Windows.
* event_pipe: call g_io_channel_win32_new_fd()Max Kellermann2010-05-191-0/+5
| | | | | | On WIN32, use g_io_channel_win32_new_fd() instead of g_io_channel_unix_new(). There doesn't seem to be a practical difference, but it seems more correct.
* Update copyright notices.Avuton Olrich2009-12-311-1/+1
|
* include config.h in all sourcesMax Kellermann2009-11-121-0/+1
| | | | | | After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
* fd_util: added O_NONBLOCK functionsMax Kellermann2009-11-081-6/+1
| | | | | Changed the wrappers for pipe(), socket(), accept(). On WIN32, this does not work for pipe().
* set the close-on-exec flag on all file descriptorsMax Kellermann2009-11-071-5/+2
| | | | | | | | | | | Added the "fd_util" library, which attempts to use the new thread-safe Linux system calls pipe2(), accept4() and the options O_CLOEXEC, SOCK_CLOEXEC. Without these, it falls back to FD_CLOEXEC, which is not thread safe. This is particularly important for the "pipe" output plugin (and others, such as JACK/PulseAudio), because we were heavily leaking file descriptors to child processes.
* client, event_pipe: explicitly ignore the write() resultMax Kellermann2009-04-011-1/+1
| | | | | | | | | | On both locations, the result of write() can be ignored safely. In event_pipe_emit_fast(), that can only be "EAGAIN", which means that the pipe buffer is full - no further notification required. In client_init(), that would be a fatal connection error, which would be caught by the next event. This patch fixes gcc warnings.
* event_pipe can only be non-blocking if !WIN32Sean McNamara2009-03-271-0/+2
|
* all: Update copyright header.Avuton Olrich2009-03-131-8/+7
| | | | | | | | This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
* added G_LOG_DOMAIN macros to several librariesMax Kellermann2009-02-191-0/+3
| | | | | Define the GLib logging domain in the following libraries: conf, daemon, event_pipe, log.
* event_pipe: remove the GLib source from the main contextMax Kellermann2009-01-101-1/+5
| | | | Free memory before exiting.
* event_pipe: removed the unused function event_pipe_wait()Max Kellermann2009-01-041-14/+4
|
* utils: removed unused functionsMax Kellermann2009-01-031-0/+3
| | | | | Removed all allocation functions, xwrite(), xread(), ARRAY_SIZE(). Those have been superseded by GLib.
* event_pipe: use GLib loggingMax Kellermann2009-01-031-2/+3
|
* event_pipe: use close() instead of xclose()Max Kellermann2009-01-031-3/+2
| | | | | xclose() aims to be the signal safe version of close(). However during cleanup, this isn't important.
* event_pipe: use _pipe() on WIN32Max Kellermann2009-01-031-2/+13
| | | | | Windows has no pipe(), it only has _pipe() with two additional parameters.
* event_pipe: moved variable "main_task" to main.cMax Kellermann2009-01-031-5/+0
|
* event_pipe: replaced PIPE_EVENT_SIGNAL with main_notifyMax Kellermann2009-01-021-14/+4
| | | | | | There is only one location using PIPE_EVENT_SIGNAL: to synchronize player_command() with player_command_finished(). Use the "notify" library instead of the event_pipe here.
* event_pipe: added event_pipe_emit_fast()Max Kellermann2009-01-011-0/+8
| | | | | | event_pipe_emit_fast() is aimed for use in signal handlers: it doesn't lock the mutex, and doesn't log on error. That makes it potentially lossy, but for its intended use, that does not matter.
* event_pipe: added pipe_event enum and callbacksMax Kellermann2009-01-011-4/+67
| | | | | | | | | Make the event_pipe (formerly main_notify) send/receive a set of events, with a callback for each one. The default event PIPE_EVENT_SIGNAL does not have a callback. It is still there for waking up the main thread, when it is waiting for the player thread.
* event_pipe: renamed functions from main_notify_* to event_pipe_*Max Kellermann2009-01-011-12/+12
| | | | Continuing the previous patch.
* main_notify: renamed source to event_pipe.cMax Kellermann2009-01-011-0/+85
We are going to migrate away from the concept of notifying the main thread. There should be events sent to it instead. This patch starts a series to implement that.