How is the flag 'bAutoDeleteRunnable' and 'bAutoDeleteSelf' in FRunnableThread::Create(...) used?
I am currently struggling with a FRunnable I created.. I set up a custom FMessageHandler inheriting FRunnable to read messages coming in via tcp. This works quite well, but I want this thing to clear its local 'Instance' field when the client disconnects (which I currently determine via ping'ing it from Server->Client).
This is my create call: Thread = FRunnableThread::Create(this, TEXT("FMessageListener"), true, true, 0, TPri_BelowNormal);
To get the messages inside my managing class, I bound a local method which gets called when a message arrived. If the message is "DISCONNECT" I set the IsActive flag to false which in turn should the Run-method inside the Thread cause to quit. After that I thought the Thread somehow knows its "done" now and will auto-delete itself. But it wont...
Any information on this? When is this auto-deletion happening? Do I get this wrong? If thats not the way to use this, then how can I delete my Instance, so that another connecting client can get its "own" instance for communication?
Thanks in advance..
EDIT: I just saw, that: "'FRunnableThread::Create': Function deprecated. Use FRunnableThread::Create without bAutoDeleteSelf and bAutoDeleteRunnable params and delete thread and runnable manually. "
It looks like I found a possible answer for this myself! After finding out, that bAutoDeleteSelf and bAutoDeleteRunnable are deprecated. I switched to a "lazy", but manually deletion of Thread and Runnable-Instance. Now these are deleted when a new client wants to connect and NOT at the end of processing a client!
This works fine now!
answered Aug 21 '17 at 12:27 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here