<html><head><base href="x-msg://4395/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1; "><div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif; "><span style="font-family: Calibri, sans-serif; color: black; ">The code example below is called from an external thread. Is that ok</span></div></div></div></div></span></blockquote><div><br></div>No - absolutely not!!! What you're trying to do - call "TaskScheduler::scheduleDelayedTask()" from an external thread - is extremely wrong! </div><div><br></div><div>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:</div><div>1/ By setting a global variable, or</div><div>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.</div><div><br></div><div>This is all explained in the FAQ that you were all asked to read before posting to this mailing list!!!</div><div><br></div><div>In your case, you would do something like the following:</div><div>1/ Within the LIVE555 thread (e.g., somewhere after you've created "rtspClient"), call</div><div><span class="Apple-tab-span" style="white-space:pre"> EventTriggerId</span> myStopStreamEvent = env.taskScheduler().createEventTrigger(StopStream);</div><div>2/ Later, from an external thread, you can call:</div><div><span class="Apple-tab-span" style="white-space:pre"> env.taskScheduler().</span>triggerEvent(myStopStreamEvent, rtspClient);</div><div>and this will cause your "StopStream()" function to be called (with "rtspClient" as parameter) from the event loop - i.e., as a handled event.</div><div>(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.)</div><br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>