Skip to content

Commit

Permalink
Fix thread safety of CUDT::uglobal() when C++11 is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
quink-black committed Apr 13, 2021
1 parent 735e839 commit af8a2f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ modified by
#include <linux/if.h>
#endif

#if !HAVE_FULL_CXX11
#if !HAVE_CXX11
// for pthread_once
#include <pthread.h>
#endif
Expand Down Expand Up @@ -216,15 +216,15 @@ struct SrtOptionAction
}
srt_options_action;

#if HAVE_FULL_CXX11
#if HAVE_CXX11

CUDTUnited* CUDT::uglobal()
{
static CUDTUnited instance;
return &instance;
}

#else // !HAVE_FULL_CXX11
#else // !HAVE_CXX11

static pthread_once_t s_UDTUnitedOnce = PTHREAD_ONCE_INIT;
static CUDTUnited* s_UDTUnited = NULL;
Expand Down

0 comments on commit af8a2f5

Please sign in to comment.