baidu / braft

An industrial-grade C++ implementation of RAFT consensus algorithm based on brpc, widely used inside Baidu to build highly-available distributed systems.
Apache License 2.0
3.86k stars 865 forks source link

fix(examples) replace pthread type with pthread_t #391

Closed ehds closed 1 year ago

ehds commented 1 year ago

Fix examples compile issues on macos13+.

on MacOS13+, pthread_t defined as :

typedef __darwin_pthread_t pthread_t;
typedef struct _opaque_pthread_t *__darwin_pthread_t;
struct _opaque_pthread_t {
    long __sig;
    struct __darwin_pthread_handler_rec  *__cleanup_stack;
    char __opaque[__PTHREAD_SIZE__];
};

bthread_t defined as: typedef uint64_t bthread_t;.

bthread_t and pthread_t are not shared the same type on MacOS SDK anymore, so we need to declare tids and pids with respective types.