Fixes to get clean i.MXADS build

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3533 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-04-26 23:11:02 +00:00
parent 383fa8a445
commit d64e93f11f
2 changed files with 13 additions and 13 deletions

View File

@ -142,19 +142,19 @@ static void *sender_thread(void *arg)
for (i = 0; i < TEST_SEND_NMSGS; i++) for (i = 0; i < TEST_SEND_NMSGS; i++)
{ {
struct timespec time; struct timespec ts;
status = clock_gettime(CLOCK_REALTIME, &time); status = clock_gettime(CLOCK_REALTIME, &ts);
if (status != 0) if (status != 0)
{ {
printf("sender_thread: ERROR clock_gettime failed\n"); printf("sender_thread: ERROR clock_gettime failed\n");
} }
time.tv_sec += 5; ts.tv_sec += 5;
/* The first TEST_SEND_NMSGS-1 send should succeed. The last /* The first TEST_SEND_NMSGS-1 send should succeed. The last
* one should fail with errno == ETIMEDOUT * one should fail with errno == ETIMEDOUT
*/ */
status = mq_timedsend(mqfd, msg_buffer, TEST_MSGLEN, 42, &time); status = mq_timedsend(mqfd, msg_buffer, TEST_MSGLEN, 42, &ts);
if (status < 0) if (status < 0)
{ {
if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT) if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT)
@ -232,20 +232,20 @@ static void *receiver_thread(void *arg)
for (i = 0; i < TEST_RECEIVE_NMSGS; i++) for (i = 0; i < TEST_RECEIVE_NMSGS; i++)
{ {
struct timespec time; struct timespec ts;
int status = clock_gettime(CLOCK_REALTIME, &time); int status = clock_gettime(CLOCK_REALTIME, &ts);
if (status != 0) if (status != 0)
{ {
printf("sender_thread: ERROR clock_gettime failed\n"); printf("sender_thread: ERROR clock_gettime failed\n");
} }
time.tv_sec += 5; ts.tv_sec += 5;
/* The first TEST_SEND_NMSGS-1 send should succeed. The last /* The first TEST_SEND_NMSGS-1 send should succeed. The last
* one should fail with errno == ETIMEDOUT * one should fail with errno == ETIMEDOUT
*/ */
memset(msg_buffer, 0xaa, TEST_MSGLEN); memset(msg_buffer, 0xaa, TEST_MSGLEN);
nbytes = mq_timedreceive(mqfd, msg_buffer, TEST_MSGLEN, 0, &time); nbytes = mq_timedreceive(mqfd, msg_buffer, TEST_MSGLEN, 0, &ts);
if (nbytes < 0) if (nbytes < 0)
{ {
if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT) if (i == TEST_SEND_NMSGS-1 && errno == ETIMEDOUT)

View File

@ -1,7 +1,7 @@
/*********************************************************************** /***********************************************************************
* examples/ostest/timedwait.c * examples/ostest/timedwait.c
* *
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -68,7 +68,7 @@ static pthread_cond_t cond;
static void *thread_waiter(void *parameter) static void *thread_waiter(void *parameter)
{ {
struct timespec time; struct timespec ts;
int status; int status;
/* Take the mutex */ /* Take the mutex */
@ -82,16 +82,16 @@ static void *thread_waiter(void *parameter)
printf("thread_waiter: Starting 5 second wait for condition\n"); printf("thread_waiter: Starting 5 second wait for condition\n");
status = clock_gettime(CLOCK_REALTIME, &time); status = clock_gettime(CLOCK_REALTIME, &ts);
if (status != 0) if (status != 0)
{ {
printf("thread_waiter: ERROR clock_gettime failed\n"); printf("thread_waiter: ERROR clock_gettime failed\n");
} }
time.tv_sec += 5; ts.tv_sec += 5;
/* The wait -- no-one is ever going to awaken us */ /* The wait -- no-one is ever going to awaken us */
status = pthread_cond_timedwait(&cond, &mutex, &time); status = pthread_cond_timedwait(&cond, &mutex, &ts);
if (status != 0) if (status != 0)
{ {
if (status == ETIMEDOUT) if (status == ETIMEDOUT)