Re: [gtkmm] new thread vs. fork to play a sound on button press



On Don, 2002-12-26 at 02:35, Mark Jones wrote:
> I don't know if this is off topic or not, but I'm sure someone will
> benefit besides me either now or in the future (archived).  I definitely
> do not think it is completely off topic.
> 
> I have a button, and when the user clicks that, I want to play a sound
> from a wav file.  esd_play_file() will allow for this.  However, I want
> to make sure it is done in the background, not holding up the gui at
> all.  I see two choices, fork at that point and then make the call to
> esd_play_file() and then exit, or start a new thread and then make the
> call to esd_play_file().  I don't care about knowing when the playing is
> finished, or about being able to stop it, at least for now I do not.

This strikes me as odd.  I never used esd_play_file(), but isn't it the
point of esd to send the playback request to a sound server and forget
about it?

> Is there a preferred method with gtkmm?  Neither way would access any
> gtkmm widgets so I do not have that to contend with.  If I choose the
> threaded method (and that is where I think this list might be a good
> place to ask about all of this), is it best to use pthreads, or glibmm
> threads, or some other alternative?  Which makes the most sense using
> gtkmm?

If you actually need it, I'd recommend the glibmm threads API since it
is readily available and just a pthread wrapper on Linux anyway.

--Daniel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]