* [ECOS] Waiting I/O operation
@ 2007-07-19 5:58 Alexey Shusharin
2007-07-20 19:31 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Shusharin @ 2007-07-19 5:58 UTC (permalink / raw)
To: ecos-discuss
Hello all,
My eCos application works with CAN I/O driver and has one thread for
processing CAN messages. I call cyg_io_read() and thread start waiting
incoming message. This situation is clear.
However I've decided to add other functionality to the thread therefore
it should wait not only I/O operation (for ex: some event flags). Now I
have these variants:
1. Create a second thread :-(
2. Make non-blocking read with a small time interval :-((
3. Add a callback functionality to CAN I/O driver and wake-up the thread
in callback function then message is coming
I prefer the last but maybe I miss the best? Does anybody have any
decisions?
Best regards
Alexey Shusharin
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ECOS] Waiting I/O operation
2007-07-19 5:58 [ECOS] Waiting I/O operation Alexey Shusharin
@ 2007-07-20 19:31 ` Andrew Lunn
2007-07-23 4:55 ` Alexey Shusharin
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2007-07-20 19:31 UTC (permalink / raw)
To: Alexey Shusharin; +Cc: ecos-discuss
On Thu, Jul 19, 2007 at 12:53:12PM +0700, Alexey Shusharin wrote:
> Hello all,
>
> My eCos application works with CAN I/O driver and has one thread for
> processing CAN messages. I call cyg_io_read() and thread start waiting
> incoming message. This situation is clear.
>
> However I've decided to add other functionality to the thread therefore it
> should wait not only I/O operation (for ex: some event flags). Now I have
> these variants:
>
> 1. Create a second thread :-(
> 2. Make non-blocking read with a small time interval :-((
> 3. Add a callback functionality to CAN I/O driver and wake-up the thread in
> callback function then message is coming
Threads in eCos are light weight. So 1) is the preferred option.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ECOS] Waiting I/O operation
2007-07-20 19:31 ` Andrew Lunn
@ 2007-07-23 4:55 ` Alexey Shusharin
0 siblings, 0 replies; 3+ messages in thread
From: Alexey Shusharin @ 2007-07-23 4:55 UTC (permalink / raw)
To: Andrew Lunn; +Cc: ecos-discuss
Andrew Lunn wrote:
> On Thu, Jul 19, 2007 at 12:53:12PM +0700, Alexey Shusharin wrote:
>> Hello all,
>>
>> My eCos application works with CAN I/O driver and has one thread for
>> processing CAN messages. I call cyg_io_read() and thread start waiting
>> incoming message. This situation is clear.
>>
>> However I've decided to add other functionality to the thread therefore it
>> should wait not only I/O operation (for ex: some event flags). Now I have
>> these variants:
>>
>> 1. Create a second thread :-(
>> 2. Make non-blocking read with a small time interval :-((
>> 3. Add a callback functionality to CAN I/O driver and wake-up the thread in
>> callback function then message is coming
>
> Threads in eCos are light weight. So 1) is the preferred option.
>
> Andrew
Hello Andrew,
Yes, second thread is the fastest solution but I prefer callback anyway. :-)
I think that saving of 2400 bytes of RAM (it's typical stack thread size
on my platform) is cost couple of my work hours (OK, one day with
testing). I've never done so exciting improvements of my code before.
One day and 2400 bytes saving. It's great.
:-)
Best regards
Alexey Shusharin
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-23 4:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 5:58 [ECOS] Waiting I/O operation Alexey Shusharin
2007-07-20 19:31 ` Andrew Lunn
2007-07-23 4:55 ` Alexey Shusharin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).