1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-04-19 21:02:17 +03:00
wsrep-lib/include/wsrep/thread.hpp
Teemu Ollakka 58ea925dc3 * Unit test for BF abort after after_command_before_result()
* Revised logic for handling BF abort around after command operations
* Added lighweight thread class for runtime thread id checking
2018-06-11 11:48:07 +03:00

37 lines
727 B
C++

//
// Copyright (C) 2018 Codership Oy <info@codership.com>
//
#include <pthread.h>
namespace wsrep
{
class thread
{
public:
class id
{
public:
id() : thread_() { }
explicit id(pthread_t thread) : thread_(thread) { }
private:
friend bool operator==(thread::id left, thread::id right)
{
return (pthread_equal(left.thread_, right.thread_));
}
pthread_t thread_;
};
thread()
: id_(pthread_self())
{ }
private:
id id_;
};
namespace this_thread
{
static inline thread::id get_id() { return thread::id(pthread_self()); }
}
};