Hello !
I’ve some question about the UE4 threading system because i got assert failed on IsInGameThread() .
I’m using a thread to Recv() data from socket, and also parsing this data etc.
Create my thread:
hProcessThread = CreateThread(NULL, 0, &MySocket::StaticThreadStart, this, 0, 0);
my recv function;
while (sess->runnable == true)
{
int inDataLength = recv(sock, (char*)m_recvBuffer.GetQueuePushPtr(), m_recvBuffer.GetLinearFreeSize(), 0);
if (inDataLength > 0)
{
_PC_mutex.lock();
amnt++;
UE_LOG(LogInit, Log, TEXT("packet recv: %d"), amnt);
ThePC->parseMyPacket(&packet);//->ParsePacket(&packet);
popPacket(&packet);
_PC_mutex.unlock();
}
}
That’s working at all, i got my packet and the parsing function work perfectly.
So here is an example:
I send login, i recv ok or not ok, then i do some thing into my playercontroller.
If my login is ok i recv my friend list and then i fill a struct and put it on a new widget:
this is exectuted in a loop and it is working if i’m not in a thread, by using thread my game crash on the get player controller.
So is any way to execute all of this inside a separate thread without getting an assert failed …?
I checked my memory adress just in case:
LogInit: This MySocket memory pointer: 0000000028CAA780
LogInit: MySocket pointer reference memory pointer PreUpdate: 0000000028CAA780
LogInit: thread MySocket memory pointer PreUpdate: 0000000028CAA780
LogInit: MySocket memory pointer player controller PreUpdate: 0000000028E71600
all the adress are ok so it’s not a segfault but a assert failed on IsInGameThread() …
Thanks for any help you can give me :).