Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #558

pthred_con_timewait problem

From ephlodur <ephlodur@linuxmail.org>
Subject pthred_con_timewait problem
Newsgroups comp.os.linux.development.apps
Message-ID <InRNs.867$OE1.126@newsfe26.iad> (permalink)
Date 2013-01-29 14:53 +0000

Show all headers | View raw


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 
			

Back to comp.os.linux.development.apps | Previous | NextNext in thread | Find similar


Thread

pthred_con_timewait problem ephlodur <ephlodur@linuxmail.org> - 2013-01-29 14:53 +0000
  Re: pthred_con_timewait problem Rainer Weikusat <rweikusat@mssgmbh.com> - 2013-01-29 15:19 +0000
    Re: pthred_con_timewait problem ephlodur <ephlodur@linuxmail.org> - 2013-01-29 15:28 +0000
      Re: pthred_con_timewait problem Sergei Organov <osv@javad.com> - 2013-01-29 19:58 +0400
        Re: pthred_con_timewait problem ephlodur <ephlodur@linuxmail.org> - 2013-01-29 17:30 +0000
          Re: pthred_con_timewait problem Sergei Organov <osv@javad.com> - 2013-01-29 22:44 +0400
            Re: pthred_con_timewait problem ephlodur <ephlodur@linuxmail.org> - 2013-01-30 11:28 +0000
  Re: pthred_con_timewait problem Richard Kettlewell <rjk@greenend.org.uk> - 2013-01-29 16:32 +0000

csiph-web