1 : /*
2 : * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 : * Use of this source code is governed by a BSD-style license that can be
4 : * found in the LICENSE file.
5 : */
6 :
7 : #include <stdio.h>
8 : #include <stdlib.h>
9 : #include <io.h>
10 :
11 : #include "native_client/src/include/portability.h"
12 : #include "native_client/src/shared/platform/nacl_exit.h"
13 : #include "native_client/src/shared/platform/win/lock_impl.h"
14 :
15 28 : NaCl::LockImpl::LockImpl() {
16 28 : InitializeCriticalSection(&mu_);
17 28 : }
18 :
19 23 : NaCl::LockImpl::~LockImpl() {
20 23 : DeleteCriticalSection(&mu_);
21 23 : }
22 :
23 28 : bool NaCl::LockImpl::Try() {
24 28 : return TryEnterCriticalSection(&mu_);
25 28 : }
26 :
27 23 : void NaCl::LockImpl::Lock() {
28 23 : EnterCriticalSection(&mu_);
29 23 : }
30 :
31 28 : void NaCl::LockImpl::Unlock() {
32 28 : LeaveCriticalSection(&mu_);
33 28 : }
|