http://zthread.sourceforge.net/ 这个库设计的很小巧,优雅,符合我个人的审美观,linux下通过编译时会出现错误,主要是由于gcc的老语法所致,由于库的作者2005年停止了更新,所以这一块一直没改,这里提供一个patch,其实很简单,就是替换了下几个语句,内容为:
#(0) put this file under top ZThread directory,such as ZThread-2.3.2/,and
#(1) cd ZThread-2.3.2
#(2) ./zthread-patch.sh (chmod +x zthread-patch.sh if necessary)
#(3) ./configure
#(4) make
sed -i '/if(!isDisabled())/s/^.*/ if(!this->isDisabled())/' ./include/zthread/Guard.h
sed -i '/waiterArrived(self)/s/^.*/ this->waiterArrived(self);/' ./src/MutexImpl.h
sed -i '/waiterDeparted(self)/s/^.*/ this->waiterDeparted(self);/' ./src/MutexImpl.h
sed -i '/ownerAcquired(self)/s/^.*/ this->ownerAcquired(self);/' ./src/MutexImpl.h
sed -i '/ownerReleased(impl)/s/^.*/ this->ownerReleased(impl);/' ./src/MutexImpl.h