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