[Live-devel] New TaskScheduler 'event trigger' mechanism, and (much) improved "DeviceSource"

BONNEAU Guy gbonneau at miranda.com
Mon Dec 13 13:56:51 PST 2010


If the scheduler is waiting on select() (in BasicTaskScheduler.cpp) to kick-in and no network activity or alarm happen to awake the select() will the new mechanism provide a mean to exit the threading loop ?

Thanks
GB

|-----Original Message-----
|From: live-devel-bounces at ns.live555.com [mailto:live-devel-
|bounces at ns.live555.com] On Behalf Of Ross Finlayson
|Sent: Saturday, December 11, 2010 1:19
|To: live-devel at ns.live555.com
|Subject: [Live-devel] New TaskScheduler 'event trigger' mechanism, and
|(much) improved "DeviceSource"
|
|One of the biggest problems that developers have had with this library is that
|it has been difficult to define and handle new kinds of event - beyond the
|file/socket I/O and delayed task events that we support by default.
|
|In particular, it has been difficult to implement input devices (such as
|encoders) when we want to signal a new event (such as the availability of new
|frame data) from an external thread.  The 'watch variable' mechanism -
|although it can be used - is not particular well-suited for this purpose.
|Furthermore, the model code in "DeviceSource.cpp" has not been particular
|helpful, because it doesn't really describe what to do to handle events that
|are signaled from an external thread.
|
|To overcome this, I have now installed a new version (2010.12.11) of the
|"LIVE555 Streaming Media" library that now includes a new 'event trigger'
|mechanism for "TaskScheduler" (and its subclass, "BasicTaskScheduler").
|
|Specifically, you can now - using the new function
|	TaskScheduler::createEventTrigger()
|- register an event handler function, to be associated with a particular 'event
|trigger id'.  At some later time, you can call
|	TaskScheduler:: triggerEvent()
|with this 'event trigger id' as parameter, and this will cause the event handler
|function to get called (from within the event loop).
|
|For more details, see "UsageEnvironment/include/UsageEnvironment.hh"
|
|One nice feature of this mechanism is that - unlike other library routines - the
|"triggerEvent()" function can be called from a separate thread.  This makes it
|easier to implement input device classes.
|
|
|I have also updated (and, I hope, significantly improved) the model code in
|"liveMedia/DeviceSource.cpp".  This code describes how to implement an
|input device class that uses the new 'event trigger'
|mechanism (with the event possibly being signaled from an external thread).
|
|If you're implementing (or have already implemented) an input device class,
|then I encourage you to take a look at the new "DeviceSource"
|code - and perhaps use this as a model for your code.
|--
|
|Ross Finlayson
|Live Networks, Inc.
|http://www.live555.com/
|_______________________________________________
|live-devel mailing list
|live-devel at lists.live555.com
|http://lists.live555.com/mailman/listinfo/live-devel



More information about the live-devel mailing list