<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">But I can't see how the implementation of triggerEvent() can be thread safe, e.g, the last line:<br class=""><br class="">fTriggersAwaitingHandling |= eventTriggerId;<br class=""><br class="">must load, modify and store the value at fTriggersAwaitingHandling</div></blockquote><div><br class=""></div>It depends on the CPU architecture.  In many (if not most?) architectures, it’ll just be a single instruction.</div><div><br class=""></div><div>I’d put a mutex around that instruction, if there were a good portable way of doing so (i.e., portable across Unix and Windows, and across both old and new compiler versions).</div><div><br class=""></div><div>Feel free to put a mutex around your call to “triggerEvent()” - to see if that solves your problem.  (In fact, you should have done that first, before speculating on this mailing list :-)</div><br class=""><br class=""><div apple-content-edited="true" class="">
<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;  "><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;  ">Ross Finlayson<br class="">Live Networks, Inc.<br class=""><a href="http://www.live555.com/" class="">http://www.live555.com/</a></span></span>
</div>
<br class=""></body></html>