File:  [parser3project] / parser3 / src / targets / isapi / Attic / pa_threads.C
Revision 1.13.2.1: download - view: text, annotated - select for diffs - revision graph
Fri Jan 31 12:34:41 2003 UTC (23 years, 5 months ago) by paf
Diff to: branchpoint 1.13: preferred, unified
grammar compiled

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

	Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
	Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
*/

static const char* IDENT_THREADS_C="$Date: 2003/01/31 12:34:41 $";

#include "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: