Max Kellermann
b3e2635ac1
event_pipe: added pipe_event enum and callbacks
...
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.
2009-01-01 18:22:11 +01:00
Max Kellermann
22bb5a5856
event_pipe: renamed functions from main_notify_* to event_pipe_*
...
Continuing the previous patch.
2009-01-01 18:12:14 +01:00
Max Kellermann
9f5934d95b
main_notify: renamed source to event_pipe.c
...
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.
2009-01-01 18:12:00 +01:00
Max Kellermann
99f8dc0168
gcc.h: removed all duplicate macros
...
Removed all macros which are already provided by GLib.
2009-01-01 18:09:28 +01:00
Max Kellermann
17bdcc8bae
decoder plugins: don't include gcc.h
...
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:09:24 +01:00
Max Kellermann
7dfe301b54
output plugins: don't include gcc.h
...
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:08:29 +01:00
Max Kellermann
0734acf392
null: don't include gcc.h
...
Use GLib's G_GNUC_UNUSED instead of macros from gcc.h.
2009-01-01 18:00:46 +01:00
Viliam Mateicka
9a70c4d06d
Moving mixers to audio outputs
2008-12-31 16:46:41 +01:00
Viliam Mateicka
dd9af72a74
exporting functions
2008-12-31 15:10:53 +01:00
Max Kellermann
3cd0b90ff6
client: run client_manager_expire() in an idle event
...
With the GLib main loop, the client manager can install its own event
in case a client is expired. No need for main.c to call
client_manager_expire() manually.
2008-12-31 14:30:03 +01:00
Laszlo Ashin
a12b57e1e9
ls.c: include config.h to have HAVE_CURL here
2008-12-31 13:00:33 +01:00
Max Kellermann
dd0f8e42f3
main_notify: removed lock()/unlock()
...
These functions are not used anymore since we use the GLib main loop.
2008-12-31 00:32:56 +01:00
Max Kellermann
2cdfd93830
client: remember GLib source id
...
Remove the event source from the GMainLoop object in
client_set_expired().
2008-12-31 00:29:27 +01:00
Max Kellermann
d196ffdf3a
sig_handlers: call g_main_loop_quit() in SIGTERM handler
...
We don't need to use asynchronous events to quit MPD, we can just call
g_main_loop_quit() inside the handler.
2008-12-30 19:50:38 +01:00
Max Kellermann
d40cf1652d
main: export the main_loop variable
...
Other libraries may need to access the main_loop reference, to add or
remove events, or to call g_main_loop_quit().
2008-12-30 19:50:22 +01:00
Max Kellermann
a3b0506cfd
sig_handlers: removed SIGCHLD
...
We have no child processes anymore. Remove the SIGCHLD handler.
2008-12-30 19:35:01 +01:00
Max Kellermann
f38aaa2bb7
sig_handlers: don't reload database on SIGHUP
...
The SIGHUP handler was used by the update process to make the main
process re-read the database. We don't need this anymore, since the
update takes place in a thread now.
2008-12-30 19:34:05 +01:00
Max Kellermann
a1434914a7
sig_handlers: removed unused functions
...
Most of these functions were obsoleted when we switched to threaded
MPD.
2008-12-30 19:32:12 +01:00
Max Kellermann
71e7ce5d8e
main: use the GLib main loop
...
This is a rather huge patch, which unfortunately cannot be splitted.
Instead of using our custom ioops.h library, convert everything to use
the GLib main loop.
2008-12-30 19:24:39 +01:00
Max Kellermann
03e650aa9e
main_notify: make the read side of the pipe blocking
...
Currently, both sides of the pipe are blocking, although we do not
need blocking read(). Convert it back to blocking. Eliminate the
select() from wait_main_task().
2008-12-30 19:20:36 +01:00
Max Kellermann
10b5966bf6
main_notify: removed notify object, use only pipe
...
To wake up the main thread, don't attempt to use a GCond/GMutex
(struct notify). This kind of mixed wakeup method has known race
conditions.
The idea behind this patch is: for wakeups which happen while the main
thread is sleeping, use only a pipe. For wakeups which happen while
the main thread is waiting for the player thread, we can later change
to GCond. For now, accept the overhead of using a pipe for the
latter.
In the long run, the main thread will never wait for the player
thread, but will do everything asynchronously.
2008-12-30 19:20:20 +01:00
Max Kellermann
1f0804bdca
listen: don't make the server socket non-blocking
...
There is no point in making the server socket non-blocking. We call
accept() only after select() has notified us about a new connection.
2008-12-30 19:18:59 +01:00
Max Kellermann
6890183c50
utils: port set_nonblocking() to WIN32
...
The new WIN32 version of set_nonblocking() can only deal with sockets,
i.e. it will fail on main_notify.c. On WIN32, we have to reimplement
main_notify.c anyway, so this is not a big deal.
2008-12-30 19:17:20 +01:00
Max Kellermann
bb55ec6b4e
command: don't allow adding local files on WIN32
...
There are no unix sockets on WIN32, and therefore no authentication.
WIN32 might have similar capabilities, but until we implement them,
disable that MPD feature.
2008-12-30 19:14:13 +01:00
Max Kellermann
7330002960
utils: implement my_usleep() with Sleep() on WIN32
...
Sleep() has only millisecond granularity, but good enough for now.
2008-12-30 19:10:08 +01:00
Max Kellermann
2eaeb65666
listen: include winsock headers on WIN32
...
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers are not available.
2008-12-30 19:07:10 +01:00
Max Kellermann
e888af98a2
bonjour: fixed "unused parameter" warnings
...
Add G_GNUC_UNUSED attributes.
2008-12-30 16:45:49 +01:00
Max Kellermann
13867a1e7c
zeroconf: eliminated strlen() usage from initZeroconf()
...
To test if a string is empty, we can just see if the first byte is 0.
No need to include string.h for strlen() here.
2008-12-30 16:45:43 +01:00
Max Kellermann
49fa9708d5
zeroconf: moved code to zeroconf-avahi.c and zeroconf-bonjour.c
...
Moved implementation specific code to their own sources, internal
declarations in zeroconf-internal.h.
2008-12-30 16:43:58 +01:00
Max Kellermann
bbed35822e
zeroconf: fail if avahi service name is invalid
...
If the configured avahi service name is invalid, abort MPD. Don't
fall back to the default service name.
2008-12-30 16:43:58 +01:00
Max Kellermann
e9a3c4ce32
playlist: use GLib's random number generator
...
srandom() and random() are not portable. Use GLib's implementation.
2008-12-30 16:34:32 +01:00
Max Kellermann
cdf1eaeb2c
daemon: simplified daemonize_close_stdin()
...
Don't bother to call fstat() or isatty() on STDIN_FILENO.
2008-12-30 16:28:18 +01:00
Max Kellermann
6c0f5fc612
listen: moved redirect_stdin() to daemon.c
...
redirect_stdin() is a daemonization function, and disconnecting from
the standard input is always a good idea for MPD.
2008-12-30 16:28:13 +01:00
Max Kellermann
671480814c
main: moved daemonize() to daemon.c
2008-12-30 16:28:07 +01:00
Max Kellermann
d99595c214
listen: eliminated freeAllListenSockets()
...
Merged freeAllListenSockets() into closeAllListenSockets(), because
this is its only caller.
2008-12-30 16:28:00 +01:00
Viliam Mateicka
4cc0caf1af
print supported decoders in --version
2008-12-30 14:17:15 +01:00
Max Kellermann
d38a7967ab
main: disable non-portable code on WIN32
...
Disable changeToUser(), daemonize(), killFromPidFile().
2008-12-29 17:43:00 +01:00
Max Kellermann
509d12ae88
utils: implement parsePath() with g_strdup() on WIN32
...
On WIN32, parsePath() now simply duplicates the input string. There
is currently nothing special we can do here. The old code was not
portable on WIN32.
2008-12-29 17:42:54 +01:00
Max Kellermann
d4638834f8
utils: use g_get_home_dir()
...
Use g_get_home_dir() to get the home directory of the current user.
This will be portable to win32.
2008-12-29 17:42:49 +01:00
Max Kellermann
db849d1eed
utils: make variables more local in parsePath()
...
Declare variables where they are really used.
2008-12-29 17:42:46 +01:00
Max Kellermann
3c9992aead
client: include winsock headers on WIN32
...
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers sys/socket.h etc. are not available.
2008-12-29 17:42:43 +01:00
Max Kellermann
274b919966
main: use g_setenv() instead of setenv()
...
Removed the fallback setenv() implementation for solaris.
2008-12-29 17:37:40 +01:00
Max Kellermann
6517126204
log: removed unused logging wrappers
...
Removed GLib logging wrappers which are not used anymore.
2008-12-29 17:35:42 +01:00
Max Kellermann
91be85a307
main: use GLib logging
2008-12-29 17:35:40 +01:00
Max Kellermann
4d3dd1ed2a
path: use GLib logging
2008-12-29 17:32:53 +01:00
Max Kellermann
29500cedff
update: use GLib logging
2008-12-29 17:29:49 +01:00
Max Kellermann
ef308d9644
alsa: use GLib logging
2008-12-29 17:29:42 +01:00
Max Kellermann
74d4ec7fbb
jack: use GLib logging
2008-12-29 17:29:36 +01:00
Max Kellermann
eddf5e1e5e
fifo: use GLib logging
2008-12-29 17:29:31 +01:00
Max Kellermann
409ee38b42
state_file: use GLib logging
2008-12-29 17:29:23 +01:00