[Live-devel] A question about DeviceSource.cpp and eventTriggers

Ross Finlayson finlayson at live555.com
Fri Dec 30 13:32:01 PST 2011


>> So my question is why is this static?
> 
> "eventTriggerId" was made a static member variable of the "DeviceSource" class, because this code was intended as an illustration of how to encapsulate a *single* device - not a set of devices.

But note also, BTW, that even if you have a set of related devices, then a single event trigger id is enough.  You can trigger the event on any one of these devices - using the single event trigger id - by passing a pointer to the specific device as the "clientData" parameter to "triggerEvent()".  A single "event trigger id" is intended to represent the 'type of event'; it's the "clientData" parameter that's intended to be used to represent the specific target for an event.

But yes - if you are accessing the code using multiple threads (with a separate TaskScheduler/UsageEnvironment for each), then the event trigger id in your device class can't be static.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111230/eee83a56/attachment.html>


More information about the live-devel mailing list