Skip to content

Commit

Permalink
sync upstream cppmyth
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Jul 1, 2017
1 parent fbb7e56 commit 6a8b478
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 2 additions & 3 deletions lib/cppmyth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
enable_language(CXX)
enable_language(C)

#include (GNUInstallDirs)

# Options
OPTION (BUILD_SHARED_LIBS "Build shared libraries." OFF)
if (MSVC)
Expand All @@ -24,7 +22,7 @@ endif ()

###############################################################################
# set lib version here
set (CPPMYTH_LIB_VERSION "2.9.3")
set (CPPMYTH_LIB_VERSION "2.9.4")
set (CPPMYTH_LIB_SOVERSION "2")

###############################################################################
Expand All @@ -47,6 +45,7 @@ if (NOT WIN32)
if (NOT CYGWIN)
add_definitions ("-fPIC")
endif ()

add_definitions ("-Wall")

include(CheckCXXCompilerFlag)
Expand Down
8 changes: 2 additions & 6 deletions lib/cppmyth/src/private/os/threads/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ namespace OS
CLockGuard lock(m_handle->mutex);
if (!m_handle->running)
{
m_handle->started = false;
m_handle->notifiedStop = false;
if (thread_create(&(m_handle->nativeHandle), CThread::ThreadHandler, ((void*)static_cast<CThread*>(this))))
{
if (wait)
m_handle->condition.Wait(m_handle->mutex, m_handle->started);
m_handle->condition.Wait(m_handle->mutex, m_handle->running);
return true;
}
}
Expand Down Expand Up @@ -111,7 +110,7 @@ namespace OS
bool IsStopped()
{
CLockGuard lock(m_handle->mutex);
return m_handle->notifiedStop;
return m_handle->notifiedStop || m_handle->stopped;
}

void Sleep(unsigned timeout)
Expand All @@ -133,7 +132,6 @@ namespace OS
volatile bool running;
volatile bool stopped;
volatile bool notifiedStop;
volatile bool started;
CCondition<volatile bool> condition;
CMutex mutex;

Expand All @@ -142,7 +140,6 @@ namespace OS
, running(false)
, stopped(true)
, notifiedStop(false)
, started(false)
, condition()
, mutex() { }
};
Expand All @@ -159,7 +156,6 @@ namespace OS
bool finalize = thread->m_finalizeOnStop;
{
CLockGuard lock(thread->m_handle->mutex);
thread->m_handle->started = true;
thread->m_handle->running = true;
thread->m_handle->stopped = false;
thread->m_handle->condition.Broadcast();
Expand Down

0 comments on commit 6a8b478

Please sign in to comment.