Skip to content

Commit

Permalink
utility: move hpc_locks to utility (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
shengofsun authored and qinzuoyan committed Oct 16, 2018
1 parent 137fa53 commit 18688e8
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <cassert>
#include <thread>
#include <dsn/ext/hpc-locks/sema.h>
#include <dsn/utility/hpc_locks/sema.h>

//---------------------------------------------------------
// AutoResetEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <thread>
#include <atomic>
#include <dsn/utility/utils.h>
#include <dsn/ext/hpc-locks/sema.h>
#include <dsn/utility/hpc_locks/sema.h>

//---------------------------------------------------------
// NonRecursiveBenaphore
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <cassert>
#include <atomic>
#include <random>
#include <dsn/ext/hpc-locks/sema.h>
#include <dsn/ext/hpc-locks/bitfield.h>
#include <dsn/utility/hpc_locks/sema.h>
#include <dsn/utility/hpc_locks/bitfield.h>

//---------------------------------------------------------
// NonRecursiveRWLock
Expand Down
File renamed without changes.
33 changes: 3 additions & 30 deletions include/dsn/utility/synchronize.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

/*
* Description:
* What is this file about?
*
* Revision history:
* xxxx-xx-xx, author, first version
* xxxx-xx-xx, author, fix bug about xxx
*/

#pragma once

#include <dsn/utility/ports.h>
#include <dsn/utility/utils.h>
// using high performance versions from https://github.com/preshing/cpp11-on-multicore

#include <dsn/ext/hpc-locks/benaphore.h>
#include <dsn/ext/hpc-locks/autoresetevent.h>
#include <dsn/ext/hpc-locks/rwlock.h>
#include <dsn/utility/hpc_locks/benaphore.h>
#include <dsn/utility/hpc_locks/autoresetevent.h>
#include <dsn/utility/hpc_locks/rwlock.h>

namespace dsn {
namespace utils {

#if 0
//# if defined(_WIN32)
class ex_lock
{
public:
ex_lock() { ::InitializeCriticalSection(&_cs); }
~ex_lock() { ::DeleteCriticalSection(&_cs); }
__inline void lock() { ::EnterCriticalSection(&_cs); }
__inline bool try_lock() { return ::TryEnterCriticalSection(&_cs) != 0; }
__inline void unlock() { ::LeaveCriticalSection(&_cs); }
private:
CRITICAL_SECTION _cs;
};
#else
class ex_lock
{
public:
Expand All @@ -69,7 +43,6 @@ class ex_lock
private:
RecursiveBenaphore _lock;
};
#endif

class ex_lock_nr
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/tests/sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* xxxx-xx-xx, author, fix bug about xxx
*/

#include <dsn/ext/hpc-locks/sema.h>
#include <dsn/utility/hpc_locks/sema.h>
#include <gtest/gtest.h>
#include <thread>

Expand Down

0 comments on commit 18688e8

Please sign in to comment.