mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-30 07:23:07 +03:00
* 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
This commit is contained in:
36
include/wsrep/thread.hpp
Normal file
36
include/wsrep/thread.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
//
|
||||
// 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()); }
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user