1


win7 プラットフォームで sem_timedwait() を使用するときにtimespec 構造体を解決するために定義する必要があるヘッダーを誰か教えてもらえますか? サポートされていますか? 私はptheadsを使用していないことに注意してください...またはboost 1.5ライブラリを使用したインタープロセスセマフォ...

ここに私が持っているもののスニペットがありますが、他に何を含めるべきかわかりません

#include <boost/thread/mutex.hpp>  
#include <boost/thread/condition.hpp>  
#include <boost/thread/thread.hpp>    
#include <semaphore.h>   
#include <time.h>  
...

sem_init(&sema, 0, 0);      
sem_init(&semb, 0, 0);  
...

struct timespec timeout = { 0, 0 };
clock_gettime( CLOCK_REALTIME, &timeout );
timeout.tv_sec += 5; //5 second timeout 
CU_ASSERT_TRUE(sem_timedwait(&sema,&timeout));   // released by another boost::thread
...
4

1 に答える 1