File tree Expand file tree Collapse file tree 2 files changed +8
-18
lines changed Expand file tree Collapse file tree 2 files changed +8
-18
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2019 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
25
25
#define SHARE_GC_Z_ZLOCK_HPP
26
26
27
27
#include " memory/allocation.hpp"
28
- #include < pthread.h >
28
+ #include " runtime/os.hpp "
29
29
30
30
class ZLock {
31
31
private:
32
- pthread_mutex_t _lock;
32
+ os::PlatformMutex _lock;
33
33
34
34
public:
35
- ZLock ();
36
- ~ZLock ();
37
-
38
35
void lock ();
39
36
bool try_lock ();
40
37
void unlock ();
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2015, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2019 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
26
26
27
27
#include " gc/z/zLock.hpp"
28
28
#include " runtime/atomic.hpp"
29
+ #include " runtime/os.inline.hpp"
29
30
#include " runtime/thread.hpp"
30
31
#include " utilities/debug.hpp"
31
32
32
- inline ZLock::ZLock () {
33
- pthread_mutex_init (&_lock, NULL );
34
- }
35
-
36
- inline ZLock::~ZLock () {
37
- pthread_mutex_destroy (&_lock);
38
- }
39
-
40
33
inline void ZLock::lock () {
41
- pthread_mutex_lock (& _lock);
34
+ _lock. lock ( );
42
35
}
43
36
44
37
inline bool ZLock::try_lock () {
45
- return pthread_mutex_trylock (& _lock) == 0 ;
38
+ return _lock. try_lock () ;
46
39
}
47
40
48
41
inline void ZLock::unlock () {
49
- pthread_mutex_unlock (& _lock);
42
+ _lock. unlock ( );
50
43
}
51
44
52
45
inline ZReentrantLock::ZReentrantLock () :
You can’t perform that action at this time.
0 commit comments