[DiscordArchive] Is this thread unsafe? There is a call like this _worldSession->ResetTimeOutTime(false) in the metho
[DiscordArchive] Is this thread unsafe? There is a call like this _worldSession->ResetTimeOutTime(false) in the metho
Archived author: Cristian • Posted: 2024-11-19T21:37:43.002000+00:00
Original source
Is this thread unsafe? There is a call like this _worldSession->ResetTimeOutTime(false) in the method WorldSocket::ReadDataHandler() that it is being called from the network thread. In the method WorldSession::ResetTimeOutTime(bool) there is a call to GameTime::GetGameTime() and that is the thing. That time is being updated at the beginning of World::Update(uint32) and that updated is being done by the main thread of the worldserver. I have inspected the GameTime.cpp file and I don’t any thread safe mechanism, no mutex, no atomics, the game time is just of type time_t (a simple long long).
So I have the question: Is this thread unsafe or I’m missing something?
Archived author: Tea • Posted: 2024-11-19T21:46:00.539000+00:00
Original source
technically not safe (in a generic sense)
Archived author: Tea • Posted: 2024-11-19T21:46:02.731000+00:00
Original source
however
Archived author: Tea • Posted: 2024-11-19T21:47:19.998000+00:00
Original source
in practice this is safe on all cpu architectures supported by TC - 64 bit memory writes are atomic on both x86 and arm64
Archived author: Cristian • Posted: 2024-11-19T21:48:45.171000+00:00
Original source
Ok, interesting . So, i was missing something. Thanks for the answer.