Logo Search packages:      
Sourcecode: libmpdclient version File versions  Download package

mpd_pure enum mpd_async_event mpd_async_events ( const struct mpd_async async  ) 

Returns a bit mask of events which should be polled for.

Definition at line 144 of file async.c.

References mpd_async::error, mpd_async::input, MPD_ASYNC_EVENT_ERROR, MPD_ASYNC_EVENT_HUP, MPD_ASYNC_EVENT_READ, MPD_ASYNC_EVENT_WRITE, mpd_async_events(), and mpd_async::output.

Referenced by mpd_async_events(), and mpd_sync_flush().

{
      enum mpd_async_event events;

      assert(async != NULL);

      if (mpd_error_is_defined(&async->error))
            return 0;

      /* always listen to hangups and errors */
      events = MPD_ASYNC_EVENT_HUP | MPD_ASYNC_EVENT_ERROR;

      if (mpd_buffer_room(&async->input) > 0)
            /* there's room left in the input buffer: attempt to
               read */
            events |= MPD_ASYNC_EVENT_READ;

      if (mpd_buffer_size(&async->output) > 0)
            /* there's data in the output buffer: attempt to
               write */
            events |= MPD_ASYNC_EVENT_WRITE;

      return events;
}


Generated by  Doxygen 1.6.0   Back to index