[Live-devel] live555 event trigger behaviour

Ross Finlayson finlayson at live555.com
Tue Jun 19 12:12:20 PDT 2012


> thank you for your answer and the modification of the triggerEvent 
> function. Unfortunately I am not completely convinced whether this 
> will cure all race conditions which are imaginable for the application 
> of the trigger method in a multithreading environment.

I believe it's now OK, as long as the statement
	 fTriggersAwaitingHandling |= eventTriggerId;
in the implementation of "triggerEvent()" is implemented as an atomic operation.


> One additional point which I would recommend you to change is the 
> implementation of the DeviceSource sample. Currently it uses a static 
> member variable for the eventTriggerId. The intention was of course that 
> all media sources which will be implemented by using that sample share ONE 
> eventTriggerId for all instances of the same class.

"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 yes, it could have been a non-static member variable instead.  (And in your environment - where are using multiple device threads - you *must* do this, because "triggerEvent()" must not be called with the same 'event trigger id' from different threads.)

I have update the comments in "DeviceSource.hh" and "DeviceSource.cpp" - to appear in the next release of the software - to make this clearer.


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/20120619/ae3a3f1d/attachment.html>


More information about the live-devel mailing list