public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Select break?
@ 2012-10-11  8:51 Allan Nielsen
  2012-10-11 13:14 ` [ECOS] " Grant Edwards
  2012-10-11 15:24 ` [ECOS] " Jay Foster
  0 siblings, 2 replies; 3+ messages in thread
From: Allan Nielsen @ 2012-10-11  8:51 UTC (permalink / raw)
  To: ecos-discuss

Hi,

Is there any way I can wakeup a select call from an other thread?

I'm using eCos threads (not posix threads), so sending a signal using
pthread_kill does not seem to be an option.

I would have guessed that I could create a file descriptor pair using
pipe, or socketpair, include this in the select list, and write some
dummy data. But since eCos does not implement either pipe or
socketpair, this does not seem to be an option either.

I have tried to use the cyg_selrecord and the cyg_selwakeup functions,
but they only cause the select function to poll the file descriptors
again.

So how can this be done using eCos threads?

Best regards
Allan W. Nielsen

-- 
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

* [ECOS] Re: Select break?
  2012-10-11  8:51 [ECOS] Select break? Allan Nielsen
@ 2012-10-11 13:14 ` Grant Edwards
  2012-10-11 15:24 ` [ECOS] " Jay Foster
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Edwards @ 2012-10-11 13:14 UTC (permalink / raw)
  To: ecos-discuss

On 2012-10-11, Allan Nielsen <a@awn.dk> wrote:

> Is there any way I can wakeup a select call from an other thread?

You used to be able to call cyg_select_abort(), which would wake up
any thread that was blocking in cyg_select_with_abort() -- which had
the same semantics as select() except it could be aborted.  It was a
great feature that I found exactly fit my needs.  But, that feature
disappeared.

Now the only practical solution I've found is to always use a timeout
when you call select() and just poll the abort condition.  No, it's
not very elegent, it wastes CPU, and in introduces a lot of latency.

-- 
Grant Edwards               grant.b.edwards        Yow! Give them RADAR-GUIDED
                                  at               SKEE-BALL LANES and
                              gmail.com            VELVEETA BURRITOS!!


-- 
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] Select break?
  2012-10-11  8:51 [ECOS] Select break? Allan Nielsen
  2012-10-11 13:14 ` [ECOS] " Grant Edwards
@ 2012-10-11 15:24 ` Jay Foster
  1 sibling, 0 replies; 3+ messages in thread
From: Jay Foster @ 2012-10-11 15:24 UTC (permalink / raw)
  To: Allan Nielsen; +Cc: ecos-discuss

Just because eCos does not have a pipe or socketpair feature does not 
mean that you cannot use an additional pair of sockets.  Add another 
socket (UDP on the loopback interface) to listen on in your select() 
call.  Add another socket (UDP) to send messages to it using sendto().  
You can bind the listening socket to the loopback interface with any 
port number (0) and use the getsockname() function to retrieve the 
actual bound socket address.  This address can be used in the sendto() 
calls.

Jay

On 10/11/2012 1:51 AM, Allan Nielsen wrote:
> Hi,
>
> Is there any way I can wakeup a select call from an other thread?
>
> I'm using eCos threads (not posix threads), so sending a signal using
> pthread_kill does not seem to be an option.
>
> I would have guessed that I could create a file descriptor pair using
> pipe, or socketpair, include this in the select list, and write some
> dummy data. But since eCos does not implement either pipe or
> socketpair, this does not seem to be an option either.
>
> I have tried to use the cyg_selrecord and the cyg_selwakeup functions,
> but they only cause the select function to poll the file descriptors
> again.
>
> So how can this be done using eCos threads?
>
> Best regards
> Allan W. Nielsen
>

-- 
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:[~2012-10-11 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-11  8:51 [ECOS] Select break? Allan Nielsen
2012-10-11 13:14 ` [ECOS] " Grant Edwards
2012-10-11 15:24 ` [ECOS] " Jay Foster

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).