/MyPaxos_mac

Paxos for MacOS

Primary LanguageC++

MyPaxos

基于 https://github.com/lyandut/HUST-Invictus 修改的Paxos代码,可以在MacOS操作系统上正确运行

USEAGE

首先需要对1.sh进行修改,/Users/wuyiyang/修改为自己用户目录

cd MyPaxos_mac
mkdir obj
mkdir bin

zsh ./1.sh

CHANGE

与原本的代码相比做了如下修改:

修改内容:

Paxos/src/lib/Lock.cpp中

int kind = PTHREAD_MUTEX_RECURSIVE_NP;

修改为

int kind = PTHREAD_MUTEX_RECURSIVE;

Paxos/src/lib/Thread.cpp中

if ( 0 != (nError = pthread_mutexattr_settype( &mutexattr, PTHREAD_MUTEX_TIMED_NP )) ) return ;

修改为

	if ( 0 != (nError = pthread_mutexattr_settype( &mutexattr, PTHREAD_MUTEX_NORMAL )) ) return ;

Paxos/src/lib/mapi.cpp中

#include <Linux/unistd.h>

#define gettid() syscall(__NR_gettid)

修改为

#include <unistd.h>

#define gettid() syscall(SYS_gettid)