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 23 : NaCl::LockImpl::LockImpl() {
16 23 : InitializeCriticalSection(&mu_);
17 23 : }
18 :
19 21 : NaCl::LockImpl::~LockImpl() {
20 21 : DeleteCriticalSection(&mu_);
21 21 : }
22 :
23 23 : bool NaCl::LockImpl::Try() {
24 23 : return TryEnterCriticalSection(&mu_);
25 23 : }
26 :
27 21 : void NaCl::LockImpl::Lock() {
28 21 : EnterCriticalSection(&mu_);
29 21 : }
30 :
31 23 : void NaCl::LockImpl::Unlock() {
32 23 : LeaveCriticalSection(&mu_);
33 23 : }
|