[ECOS] pthread version of cyg_thread_delay

Laurie Gellatly laurie.gellatly@netic.com
Thu Nov 13 14:57:00 GMT 2008


Tyler,
A quick google suggests that others have found 'select' as a possible 
solution.

Another approach might be to use #define to for OS specific calls.
Then you can use similar functionality that is OS dependant.

			...Laurie:{)

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-
> owner@ecos.sourceware.org] On Behalf Of Tyler Wilson
> Sent: Thursday, 13 November 2008 1:42 PM
> To: ecos-discuss@ecos.sourceware.org
> Subject: [ECOS] pthread version of cyg_thread_delay
> 
> In a previous thread I started here on the list, asking about the
> synthetic target, it was suggested a better approach might be to use
> the
> POSIX threads compatibility layer in eCos, and write to that. This
> would
> allow the application code to be the same for both eCos and Linux - and
> potentially Windows with pthreads-win32 (if it works).
> 
> As a starting point I thought it would be useful to do a simple port of
> the 'twothreads' example to a POSIX threads version, which I call it
> 'twopthreads' - original, ugh.
> 
> One item I have run in to, not being a pthreads expert, is what the
> POSIX equivilant of cyg_thread_delay might be. There is a pthread_yield
> type call, but there is no way to give it some time value, and have the
> system do the proper thing in the background.
> 
> I have tried using nanosleep, but it results in some odd behavior -
> some
> sort of SIGTRAP occurs when I use it. I have also tried to use
> cyg_thread_delay directly, but that did not work either.
> 
> So, any examples or pointers to a pthread-friendly way to perform a
> delay within a thread function?
> 
> Thank you,
> Tyler
> 
> --
> Before posting, please read the FAQ:
> http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list