File:  [parser3project] / parser3 / src / targets / isapi / Attic / pa_threads.C
Revision 1.22: download - view: text, annotated - select for diffs - revision graph
Tue Feb 7 22:00:45 2017 UTC (9 years, 5 months ago) by moko
Branches: MAIN
CVS tags: release_3_4_5, HEAD
Copyright year: 2015->2017

/** @file
	Parser: zero Mutex realization class.

	Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
	Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
*/

#include "pa_threads.h"

volatile const char * IDENT_PA_THREADS_C="$Id: pa_threads.C,v 1.22 2017/02/07 22:00:45 moko Exp $" IDENT_PA_THREADS_H;

#include <windows.h>

const bool parser_multithreaded=true;

pa_thread_t pa_get_thread_id() {
	return GetCurrentThreadId();
}

Mutex global_mutex;

Mutex::Mutex() :
	handle(reinterpret_cast<uint>(CreateMutex(NULL, FALSE, 0))) {
}

Mutex::~Mutex() {
	CloseHandle(reinterpret_cast<HANDLE>(handle));
}

void Mutex::acquire() {
    WaitForSingleObject(reinterpret_cast<HANDLE>(handle), INFINITE);
}

void Mutex::release() {
    ReleaseMutex(reinterpret_cast<HANDLE>(handle));
}

E-mail: