SECMATNT <NOSPAMinfo.secmat@wanadoo.fr> wrote:
Hi,
When using kernel a timeout, the duration is passed using an integer
uint64_t in nanoseconds , it works fine excepted the fact that the value
seems to be limited to 32 bits (more than 2 seconds). I want to extend the
timeout to 10 seconds… how can I do that ? I’m using QNX 6.1 on a x86
computer.
You might be having problems with compiler or types on your input.
The following program:
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#include <sys/neutrino.h>
int main()
{
int t1, t2;
struct sigevent ev;
uint64_t to;
int chid;
int ret, serrno;
to = 1010001000*1000LL;
chid = ChannelCreate(0);
ev.sigev_notify = SIGEV_UNBLOCK;
t1 = time(NULL);
TimerTimeout(CLOCK_REALTIME, _NTO_TIMEOUT_RECEIVE, &ev, &to, NULL);
ret = MsgReceive(chid, NULL, 0, NULL);
serrno = errno;
t2 = time(NULL);
printf(“receive returned %d, errno %d: %s\n”, ret, errno, strerror(errno));
printf(“t1 is %d, t2 is %d, blocked for: %d seconds\n”,t1, t2, (t2-t1) );
return 0;
}
Produced:
receive returned -1, errno 260: Connection timed out
t1 is 1024949902, t2 is 1024949912, blocked for: 10 seconds
That is, it slept for 10 seconds.
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.