On Apr 27, 2009, at 10:46 PM, Alex Harrington wrote: >> Um - I just looked at your code on launchpad and... libavg functions >> should be called from one thread only, or everything will be very >> unstable. Have a look at Player.setTimeout(), Player.setInterval() >> and >> Player.setOnFrameHandler(). I think you can easily do everything you >> need using these methods, without using threads. > > Thanks Uli. I'll have to think about that in more detail then. The > whole app is/will be highly threaded because of the background work > it has to do collecting files, preparing schedules, uploading logs etc > > I'd envisaged threads to control each "media item" on the layout > since they're extensible and could need to do anything - eg iterate > round loops etc - without causing the rest of the player to lock in > any way. I'm aware of setTimeout and setInterval but I'm not 100% > sure at the moment how I'll get it all to hang together.
Ok, I think I understand what you're trying to do. You can actually implement state machines quite easily in an event-driven fashion by using event handlers of some sort to change the user interface state. It actually makes a lot of sense to keep all the housekeeping in separate threads and send signals of some sort to the libavg thread when the user interface needs to change. This does mean polling the signal state regularly (in an onFrameHandler or similar), but it also guarrantees you'll have a correct separation of application logic and user interface :-). Cheers, Uli -- Any technology distinguishable from magic is insufficiently advanced. Ulrich von Zadow | +49-172-7872715 Jabber: [email protected] Skype: uzadow _______________________________________________ libavg-users mailing list [email protected] https://mail.datenhain.de/mailman/listinfo/libavg-users
