1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Cleanup jthread and fix win32 build

This commit is contained in:
sapier 2013-12-01 01:52:06 +01:00
parent f3439c40d8
commit 04e9a9d541
29 changed files with 185 additions and 194 deletions

View file

@ -16,26 +16,27 @@ You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <assert.h>
#include "jthread/jsemaphore.h"
JSemaphore::JSemaphore() {
sem_init(&m_semaphore,0,0);
assert(sem_init(&m_semaphore,0,0) == 0);
}
JSemaphore::~JSemaphore() {
sem_destroy(&m_semaphore);
assert(sem_destroy(&m_semaphore) == 0);
}
JSemaphore::JSemaphore(int initval) {
sem_init(&m_semaphore,0,initval);
assert(sem_init(&m_semaphore,0,initval) == 0);
}
void JSemaphore::Post() {
sem_post(&m_semaphore);
assert(sem_post(&m_semaphore) == 0);
}
void JSemaphore::Wait() {
sem_wait(&m_semaphore);
assert(sem_wait(&m_semaphore) == 0);
}
int JSemaphore::GetValue() {