<div dir="ltr">Hi,<div>My C# app uses ESL to interact with FS. It plays wav files via bgapi and receives and processes the events of the playbacks.  The listening thread is started like  ManagedESLTest program:</div><div><br>
</div><div>ThreadPool.QueueUserWorkItem(new WaitCallback(getFsEventsInboundMode));</div><div><br></div><div>this thread ends up in a while loop where the events are received:</div><div><br></div><div><div>                while (eslConnection.Connected() == ESL_SUCCESS &amp;&amp; !stopConnection)</div>
<div>                {</div><div>                    eslEvent = eslConnection.RecvEventTimed(50); </div><div>                    if (eslEvent != null)</div><div>                    {</div><div>                        onFreeswitcEvent(eslEvent );</div>
<div>                    }</div><div>                }</div></div><div>onFreeSwitchEvent calls ends up in an other thread.</div><div><br><div>bgapi commands is sent via the same eslConnection, I assume that the occasional Accessviolation at RecvEventTimed is caused by sending bgapi commands via the same eslConnection from an other thread. Could that be the cause?</div>
</div><div><br></div><div>Other related questions:</div><div>Is it safe to pass eslEvent to an other thread, or it should be serialized? If so is there a best practice to serialize?</div><div><br></div><div>Is there some kind of event buffer in eslConnection, or the RecvEvent misses all the events which &quot;arrived&quot; before the call?</div>
<div><br></div><div>Thank you in advance:</div><div>Ferenc</div><div><br></div><div><br></div><div><br></div><div><br></div></div>