I’m creating a FRunnable on UGameInstance.Init() with FRunnableThread::Create
In Run() function I’m reading from a socket with recv and the thread gets locked waiting for data.
If I stop the editor it freezes waiting for thread to finalize.
I override Shutdown() and BeginDestroy() in UGameInstance closing the socket with closesocket but this functions are never called.
Anybody knows why this functions are never called and how can I solve it?
Thank you in advance.
Could you show some code of your run function so that I know what youre doing? It’s possible that run is never finished and the main thread will freeze trying to destroy the thread when waiting for it to finish first.
Sure… As I said recv func locks the thread. If the main thread tries to destroy it I don’t understand how the cleanup works because Stop() is never called.