On Thu, 16 Dec 2004 08:46:58 +0000, Ben Rudiak-Gould <[EMAIL PROTECTED]> wrote: > Sebastian Sylvan wrote: > > >If there was a way to simply defer GC (like you attatch a function to > >an object which can simply deny the GC the right to remove it > >depending on its state) then I wouldn't have to do anything > >significant in the finalizer. > > Why not spawn a thread which starts the playback, waits for it to > finish, and then exits, and wrap the whole thread in a call to > withForeignPtr? Then your finalizer won't be called prematurely.
Well I could do this, but for one it would be cumbersome to stop playback. I could, of course, return some sort of Playback datatype which contains a Chan that can be written to with some commands, and then have the playback-loop (spawned with a forkIO) check this periodically and apply the commands to the "real" playback channel. However I'd need a pretty tight polling-loop to get these commands responsive, and that just seems like a waste of processing power. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
