diff --git a/CMakeLists.txt b/CMakeLists.txt index 65050f8..e4a3585 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,7 @@ set(BUILDAT_CORE_SRCS src/impl/noise.cpp src/impl/voxel_volume.cpp src/impl/compress.cpp + src/impl/worker_thread.cpp ) if(WIN32) set(BUILDAT_CORE_SRCS ${BUILDAT_CORE_SRCS} src/impl/windows/file_watch.cpp) diff --git a/src/interface/semaphore.h b/src/interface/semaphore.h new file mode 100644 index 0000000..8a6df54 --- /dev/null +++ b/src/interface/semaphore.h @@ -0,0 +1,32 @@ +// http://www.apache.org/licenses/LICENSE-2.0 +// Copyright 2014 Perttu Ahola +#pragma once +#include "core/types.h" +#ifdef _WIN32 + #include "ports/windows_compat.h" +#else + #include +#endif + +namespace interface +{ + struct Semaphore + { + sem_t sem; + + Semaphore(unsigned int value = 0){ + sem_init(&sem, 0, value); + } + ~Semaphore(){ + sem_destroy(&sem); + } + void wait(){ + sem_wait(&sem); + } + void post(){ + sem_post(&sem); + } + }; +} + +// vim: set noet ts=4 sw=4: