This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: pthread version of cyg_thread_delay
- From: "Laurie Gellatly" <laurie dot gellatly at netic dot com>
- To: "'Tyler Wilson'" <TWilson at ugobe dot com>, <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 13 Nov 2008 14:24:24 +1100
- Subject: RE: [ECOS] pthread version of cyg_thread_delay
- References: <B3D51DDE088F664CA567D79180F5DD3C50C6B8@ev-core.ugobe.local>
- Reply-to: <laurie dot gellatly at netic dot com>
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