RTC Forums
November 25, 2024, 02:41:37 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
TRtcDelayedCall from within a thread
Pages: [
1
]
« previous
next »
Print
Author
Topic: TRtcDelayedCall from within a thread (Read 5517 times)
johannc
RTC License++
Posts: 7
TRtcDelayedCall from within a thread
«
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.
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcDelayedCall from within a thread
«
Reply #1 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
Logged
johannc
RTC License++
Posts: 7
Re: TRtcDelayedCall from within a thread
«
Reply #2 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.
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcDelayedCall from within a thread
«
Reply #3 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
Logged
johannc
RTC License++
Posts: 7
Re: TRtcDelayedCall from within a thread
«
Reply #4 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.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...