Title: TRtcDelayedCall from within a thread Post by: johannc on May 18, 2010, 09:26:01 PM Are there any known issues with calling a TRtcDelayedCall from within a thread other than the main thread? I seem to have an issue where if I do, then Wakeup no longer immediately call the event but the event will be called after the timeout period; especially after subsequent calls to the server. If I wrap the call in a CriticalSection it works properly all the time. Just wanted to know.
Thanks. Title: Re: TRtcDelayedCall from within a thread Post by: D.Tkalcec (RTC) on May 18, 2010, 10:05:45 PM I'm not sure I understand your question. Are you asking if there are issues with using the "WakeUp" method of the TRtcDelayedCall object from background threads?
If that's what you are asking, then the answer is that the WakeUp method should work from anywhere, but it may ONLY be used once and ONLY if the TRtcDelayedCall object wasn't already destroyed (for example, because the connection timed out or the timeout set for the TRtcDelayedCall occured). If everything works fine when you place the WakeUp call inside a CriticalSection and you make sure the object is not used ANYWHERE after the WakeUp call, chances are that the same TRtcDelayedCall object was being accessed from multiple threads at the same time, which is definitely something that you should NOT allow. Best Regards, Danijel Tkalcec Title: Re: TRtcDelayedCall from within a thread Post by: johannc on May 18, 2010, 10:09:36 PM Yes that's exactly what I was asling sorry. Yeah wanted to know if calling Wakeup from background threads was a no-no. What I haven't done however is to remove the object after Wakeup. That I will implement now.
Thanks for your quick reply. Title: Re: TRtcDelayedCall from within a thread Post by: D.Tkalcec (RTC) on May 18, 2010, 10:14:48 PM Just to clarify: By "remove the object" I meant that you should remove the pointer to the TRtcDelayedCall object, so you do NOT try to use it again. But you should NOT try to Free/Destroy the TRtcDelayedCall object, because it will be destroyed by the RTC SDK.
Best Regards, Danijel Tkalcec Title: Re: TRtcDelayedCall from within a thread Post by: johannc on May 18, 2010, 10:18:35 PM No no no, not free or destroy. It is kept in a container and I will remove it's identifier from the container.
|