mpd/src/notify.h
Eric Wong 53be85e1b1 notify: more cleanups, add error checking for pipe errors
Don't bother initializing the junk buffer, we really don't care.
The array was also unnecessary and ugly.

Also, avoid returning the byte count we read/wrote since it
unnecessarily exposes internal details of the implementation to
the callers.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7219 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26 10:39:13 +00:00

48 lines
1.5 KiB
C

/* the Music Player Daemon (MPD)
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
* This project's homepage is: http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef NOTIFY_H
#define NOTIFY_H
/*
* This library implements inter-process signalling using blocking
* read() on an anonymous pipe. As a side effect, the read() system
* call has the same signal interruption behaviour as the old sleep
* function.
*
* As soon as mpd uses threading instead of fork()/shm, we can replace
* this library with a pthread_cond object.
*
* This code is experimental and carries a lot of overhead. Still, it
* uses less resources than the old polling code with a fixed sleep
* time.
*
*/
typedef struct _Notify {
int fds[2];
} Notify;
void initNotify(Notify *notify);
void waitNotify(Notify *notify);
void signalNotify(Notify *notify);
#endif