Max Kellermann <[EMAIL PROTECTED]> wrote:
> On 2008/10/01 12:36, Eric Wong <[EMAIL PROTECTED]> wrote:

<snip> I'll try to look more closely at the other stuff when I'm more
awake.

> > Adding a user-configurable async flag to each audio_output
> > (defaulting to off for backwards compatibility) for playback could
> > be useful.  This way users can choose which outputs they value over
> > others.
> 
> There could be a "primary" output - the first one which is configured?

No "magic" stuff like this in the config file, please.

> > enable/disable/close/open should always be async, though; just
> > playback should be (optionally) synchronous.
> 
> Why?  open() is my favorite method which might block the full MPD
> daemon if that isn't performed asynchronously.

I meant they should be asynchronous from the perspective of other mpd
threads.  Each audio_output thread can block all they want as long as
the rest of mpd doesn't block on them.

> > synchronous notification is much easier in some cases.  It is much
> > nicer for some "fast" things such as dropping the output buffer when
> > skipping tracks; but I agree that async is much better in many
> > cases, too...
> 
> But with my code, all N output devices can drop their output buffer at
> the same time.  That may require some long lasting blocking system
> calls.

I meant the userspace output buffer we use for xfade/volume effects (and
only as an example).  We should not rely on the external dependencies to
do async stuff right since there are too many variables to account for.

> > I would just use pthread_mutex_trylock() and then broadcast if I get
> > locks from the required set of outputs...
> 
> Too complicated, for no good reason.

Dunno, haven't tried it yet :)

> > No races, but one bug and the aforementioned issue:
> > 
> > A definite bug: pthread_cond_wait is subject to spurious wakeups so you
> > need to restart pthread_cond_wait if pending is not set.
> > assert(notify->pending) is wrong after pthread_cond_wait.
> 
> It is?  That's not documented... well, to be on the safe side, I have
> added a patch for that.

It's in the POSIX manpages.  The section 3 manpages I got from Debian
seem mainly for LinuxThreads.

-- 
Eric Wong

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to