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



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.

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?

Thanks,

-- 

Mark
http://www.utdallas.edu/~mej017200/




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