On Mon, 28 Jan 2013 20:44:59 -0500, Lew Pitcher wrote:
> On Monday 28 January 2013 20:29, in comp.os.linux.development.apps,
>
ephl...@linuxmail.org wrote:
>
>> need some help with pthread..
>
> It helps if you ask the question
thanks for your reply...
my problem is with pthread... I have a class that handle access to a msg
queue with the below code..
this the part that is causing me problem...the init for the
pthread_con_timewait is below..
protected:
pthread_cond_t _event_id;
pthread_condattr_t cattr;
// Prevent copying or assignment
CEvent(const CEvent& _arg);
CEvent& operator=(const CEvent& _rhs);
public:
CEvent(){
//pthread_attr_init(&cattr);
pthread_condattr_setclock(&cattr,
CLOCK_MONOTONIC);
pthread_cond_init(&_event_id,&cattr);
the call to the pthread_con_timewait is below
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC,&ts);
ts.tv_sec += delay; //time that I want to wait
lock();//unlock in this case is define as a base
class CEvent...
_ret = pthread_cond_timedwait(&_event_id, &_m_mutex, &ts);
unlock();
but when ever I make that call it always return with EPERM
My system is ubuntu 11.X I have done a lot of google search a lot on
implementation are like that ...If I use gettimeofday a make the proper
adjustment the call to timewait never return ...in other cases when I use
CLOCK_REALTIME it always return with EPERM ... can you give me any pointer
how should this call be implemented on linux...
thanks for any help..
ephlodur