1. 29 Aug, 2008 1 commit
  2. 28 Aug, 2008 3 commits
    • Max Kellermann's avatar
      client: renamed all public functions · c0197c58
      Max Kellermann authored
      Functions which operate on the whole client list are prefixed with
      "client_manager_", and functions which handle just one client just get
      "client_".
      c0197c58
    • Max Kellermann's avatar
      renamed interface.c to client.c · deb29e08
      Max Kellermann authored
      I don't believe "interface" is a good name for something like
      "connection by a client to MPD", let's call it "client".  This is the
      first patch in the series which changes the name, beginning with the
      file name.
      deb29e08
    • Max Kellermann's avatar
      include cleanup · 1560a70b
      Max Kellermann authored
      Only include headers which are really needed.
      1560a70b
  3. 26 Aug, 2008 10 commits
  4. 02 Jun, 2008 1 commit
  5. 13 Apr, 2008 2 commits
  6. 12 Apr, 2008 5 commits
    • Eric Wong's avatar
      Fix the problem of songs not advancing without client activity · baf9b94e
      Eric Wong authored
      The select() in the main event loop blocks now (saving us many
      unnecessary wakeups).  This interacted badly with the threads
      that were trying to wakeup the main task via
      pthread_cond_signal() since the main task was not blocked
      on a condition variable, but on select().
      
      So now if we detect a need to wakeup the player, we write
      to a pipe which select() is watching instead of blindly
      calling pthread_cond_signal().
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      baf9b94e
    • Max Kellermann's avatar
      pass dc to decoder_task() · 14529af7
      Max Kellermann authored
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      14529af7
    • Max Kellermann's avatar
      pass pc to player_task() · 1465bfab
      Max Kellermann authored
      Another global variable cleanup patch.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      1465bfab
    • Max Kellermann's avatar
      use the notify API in the main thread · 4ee8396f
      Max Kellermann authored
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7283 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      4ee8396f
    • Eric Wong's avatar
      Initial cut of fork() => pthreads() for decoder and player · 9cf66d0e
      Eric Wong authored
      I initially started to do a heavy rewrite that changed the way processes
      communicated, but that was too much to do at once.  So this change only
      focuses on replacing the player and decode processes with threads and
      using condition variables instead of polling in loops; so the changeset
      itself is quiet small.
      
      * The shared output buffer variables will still need locking
      to guard against race conditions.  So in this effect, we're probably
      just as buggy as before.  The reduced context-switching overhead of
      using threads instead of processes may even make bugs show up more or
      less often...
      
      * Basic functionality appears to be working for playing local (and NFS)
      audio, including:
      play, pause, stop, seek, previous, next, and main playlist editing
      
      * I haven't tested HTTP streams yet, they should work.
      
      * I've only tested ALSA and Icecast.  ALSA works fine, Icecast
      metadata seems to get screwy at times and breaks song
      advancement in the playlist at times.
      
      * state file loading works, too (after some last-minute hacks with
      non-blocking wakeup functions)
      
      * The non-blocking (*_nb) variants of the task management functions are
      probably overused.  They're more lenient and easier to use because
      much of our code is still based on our previous polling-based system.
      
      * It currently segfaults on exit.  I haven't paid much attention
      to the exit/signal-handling routines other than ensuring it
      compiles.  At least the state file seems to work.  We don't
      do any cleanups of the threads on exit, yet.
      
      * Update is still done in a child process and not in a thread.
      To do this in a thread, we'll need to ensure it does proper
      locking and communication with the main thread; but should
      require less memory in the end because we'll be updating
      the database "in-place" rather than updating a copy and
      then bulk-loading when done.
      
      * We're more sensitive to bugs in 3rd party libraries now.
      My plan is to eventually use a master process which forks()
      and restarts the child when it dies:
      locking and communication with the main thread; but should
      require less memory in the end because we'll be updating
      the database "in-place" rather than updating a copy and
      then bulk-loading when done.
      
      * We're more sensitive to bugs in 3rd party libraries now.
      My plan is to eventually use a master process which forks()
      and restarts the child when it dies:
      
      master - just does waitpid() + fork() in a loop
      \- main thread
      \- decoder thread
      \- player thread
      
      At the beginning of every song, the main thread will set
      a dirty flag and update the state file.  This way, if we
      encounter a song that triggers a segfault killing the
      main thread, the master will start the replacement main
      on the next song.
      
      * The main thread still wakes up every second on select()
      to check for signals; which affects power management.
      
      [merged r7138 from branches/ew]
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7240 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      9cf66d0e
  7. 26 Mar, 2008 1 commit
  8. 03 Jan, 2008 1 commit
    • Eric Wong's avatar
      Cleanup #includes of standard system headers and put them in one place · cb8f1af3
      Eric Wong authored
      This will make refactoring features easier, especially now that
      pthreads support and larger refactorings are on the horizon.
      
      Hopefully, this will make porting to other platforms (even
      non-UNIX-like ones for masochists) easier, too.
      
      os_compat.h will house all the #includes for system headers
      considered to be the "core" of MPD.  Headers for optional
      features will be left to individual source files.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      cb8f1af3
  9. 28 Dec, 2007 1 commit
    • Eric Wong's avatar
      Merge branches/ew r7104 · b79f6b88
      Eric Wong authored
      thread-safety work in preparation for rewrite to use pthreads
      
      Expect no regressions against trunk (r7078), possibly minor
      performance improvements in update (due to fewer heap
      allocations), but increased stack usage.
      
      Applied the following patches:
      
      * maxpath_str for reentrancy (temporary fix, reverted)
      * path: start working on thread-safe variants of these methods
      * Re-entrancy work on path/character-set conversions
      * directory.c: exploreDirectory() use reentrant functions here
      * directory/update: more use of reentrant functions + cleanups
      * string_toupper: a strdup-less version of strDupToUpper
      * get_song_url: a static-variable-free version of getSongUrl()
      * Use reentrant/thread-safe get_song_url everywhere
      * replace rmp2amp with the reentrant version, rmp2amp_r
      * Get rid of the non-reentrant/non-thread-safe rpp2app, too.
      * buffer2array: assert strdup() returns a usable value in unit tests
      * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants
      * fix storing playlists w/o absolute paths
      * parent_path(), a reentrant version of parentPath()
      * parentPath => parent_path for reentrancy and thread-safety
      * allow "make test" to automatically run embedded unit tests
      * remove convStrDup() and maxpath_str()
      * use MPD_PATH_MAX everywhere instead of MAXPATHLEN
      * path: get rid of appendSlash, pfx_path and just use pfx_dir
      * get_song_url: fix the ability to play songs in the top-level music_directory
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      b79f6b88
  10. 04 Jun, 2007 1 commit
  11. 26 May, 2007 1 commit
  12. 25 Apr, 2007 1 commit
  13. 05 Apr, 2007 1 commit
  14. 18 Feb, 2007 1 commit
  15. 17 Jan, 2007 1 commit
  16. 11 Jan, 2007 1 commit
  17. 08 Jan, 2007 2 commits
  18. 26 Aug, 2006 1 commit
    • Eric Wong's avatar
      Replace strdup and {c,re,m}alloc with x* variants to check for OOM errors · 90847fc8
      Eric Wong authored
      I'm checking for zero-size allocations and assert()-ing them,
      so we can more easily get backtraces and debug problems, but we'll
      also allow -DNDEBUG people to live on the edge if they wish.
      
      We do not rely on errno when checking for OOM errors because
      some implementations of malloc do not set it, and malloc
      is commonly overridden by userspace wrappers.
      
      I've spent some time looking through the source and didn't find any
      obvious places where we would explicitly allocate 0 bytes, so we
      shouldn't trip any of those assertions.
      
      We also avoid allocating zero bytes because C libraries don't
      handle this consistently (some return NULL, some not); and it's
      dangerous either way.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      90847fc8
  19. 14 Aug, 2006 1 commit
    • Eric Wong's avatar
      Several bugfixes during exit found by valgrind · e5df85db
      Eric Wong authored
      First, make sure we call finishPlaylist() before
      closeMp3Directory() since the latter will free non-SONG_TYPE_URL
      songs in playlist, which causes an invalid read when we try to
      look for SONG_TYPE_URL songs to free in finishPlaylist.
      
      Secondly, make sure our children have all exited before freeing
      the playerData.  If we do not, slowly-delivered signals can
      trigger a race condition in the signal handlers of the decode
      and player processes which rely on getPlayerData.  To avoid
      waitpid-ing too long (or at all), move the freePlayerData() call
      farther down in main() (this won't affect anything else)
      to give the OS a better chance to deliver signals and finish running
      sig handlers for terminated children.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4640 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      e5df85db
  20. 07 Aug, 2006 1 commit
  21. 06 Aug, 2006 1 commit
  22. 03 Aug, 2006 1 commit
  23. 01 Aug, 2006 1 commit
    • Eric Wong's avatar
      logging cleanups · 89073cfb
      Eric Wong authored
      * Moved all logging-related stuff into log.c
      (and not myfprintf.c)
      
      * ISO C90-compliant strftime usage:
      %e and %R replaced with %d and %H:%M respectively
      
      * Got rid of variadic macros since some old-school compilers
      don't like them
      
      * compiling with -DNDEBUG disables the DEBUG() macro
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@4512 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      89073cfb