> The code example below is called from an external thread. Is that ok

No - absolutely not!!!   What you're trying to do - call 
"TaskScheduler::scheduleDelayedTask()" from an external thread - is extremely 
wrong! 

Look folks, how many times do I have to say this: A LIVE555 application runs as 
a single-thread of control (using an event loop, rather than threads, to 
provide concurrency).  If you want to communicate with a LIVE555 application 
from an external thread (i.e., from a thread other than the one that runs the 
LIVE555 event loop), then there are only two proper ways to do this:
1/ By setting a global variable, or
2/ Using an 'event trigger' - i.e., by calling "TaskScheduler::triggerEvent()". 
 Note that "triggerEvent()" is the ***only*** LIVE555 function that you may 
call from an external thread.

This is all explained in the FAQ that you were all asked to read before posting 
to this mailing list!!!

In your case, you would do something like the following:
1/ Within the LIVE555 thread (e.g., somewhere after you've created 
"rtspClient"), call
        EventTriggerId myStopStreamEvent = 
env.taskScheduler().createEventTrigger(StopStream);
2/ Later, from an external thread, you can call:
        env.taskScheduler().triggerEvent(myStopStreamEvent, rtspClient);
and this will cause your "StopStream()" function to be called (with 
"rtspClient" as parameter) from the event loop - i.e., as a handled event.
(Note: For this to work, "env", "myStopStreamEvent" and "rtspClient" need to be 
global variables, so that they are visible to the external thread.  Note, 
though, that they are never *modified* by the external thread, only read by it.)


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

_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to