Skip to content

Commit

Permalink
Update net_ws.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
In-line authored Feb 1, 2018
1 parent 91c8e68 commit 4fce6a1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rehlds/engine/net_ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ void* NET_ThreadMain(void*)
NET_ThreadLock();

#ifdef REHLDS_FIXES
if(net_thread_terminated)
if (net_thread_terminated)
{
NET_ThreadUnlock();
return 0;
Expand Down Expand Up @@ -1216,7 +1216,7 @@ void NET_StartThread()
pthread_mutexattr_init(&net_mutex_attr);
pthread_mutexattr_settype(&net_mutex_attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&net_mutex, &net_mutex_attr);
if(pthread_create(&hNetThread, nullptr, &NET_ThreadMain, nullptr) != 0)
if (pthread_create(&hNetThread, nullptr, &NET_ThreadMain, nullptr) != 0)
{
pthread_mutex_destroy(&net_mutex);
#endif
Expand Down Expand Up @@ -1244,7 +1244,7 @@ void NET_StopThread()
#ifdef _WIN32

#ifdef REHLDS_FIXES
if(WaitForSingleObject(hNetThread, 0.5 * 1000) != WAIT_OBJECT_0) // Wait 0.5 second for thread to finish
if (WaitForSingleObject(hNetThread, 0.5 * 1000) != WAIT_OBJECT_0) // Wait 0.5 second for thread to finish
#endif // REHLDS_FIXES
{
TerminateThread(hNetThread, 0); // Kill unresponsive thread.
Expand All @@ -1253,12 +1253,12 @@ void NET_StopThread()

#else // _WIN32
struct timespec ts;
if(clock_gettime(CLOCK_REALTIME, &ts) == -1) {
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
Sys_Error("%s: CLOCK_REALTIME ERROR: %s", __func__, NET_ErrorString(NET_GetLastError()));
}
ts.tv_nsec += 0.5 * 1000000000; // Wait 0.5 second for thread to finish

if(pthread_timedjoin_np(hNetThread, nullptr, &ts) != 0)
if (pthread_timedjoin_np(hNetThread, nullptr, &ts) != 0)
{
pthread_cancel(hNetThread); // Kill unresponsive thread.
pthread_join(hNetThread, nullptr);
Expand Down

0 comments on commit 4fce6a1

Please sign in to comment.