public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* Methods for "signalling" other threads?
@ 2005-10-25 15:56 Mark Nowhere
  2005-10-25 17:20 ` Ronny Pfannschmidt
  2005-10-25 23:58 ` Arash Partow
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Nowhere @ 2005-10-25 15:56 UTC (permalink / raw)
  To: pthreads-win32

Hi,
    Just a quick question. I have a serial
reader/writer thread and an network reader/writer
thread. Basically I want the serial thread to, once
new data has come in from the COMM port signal the
network thread in some way to get it to pick up the
data and send it over the network. Just not sure what
I should use to get this effect?

Options I can see are:

Semaphores
or 
pthread_cond_signal/pthread_cond_wait stuff
or 
something else :)

Many thanks for any advice

Mark


		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Methods for "signalling" other threads?
  2005-10-25 15:56 Methods for "signalling" other threads? Mark Nowhere
@ 2005-10-25 17:20 ` Ronny Pfannschmidt
  2005-10-25 23:58 ` Arash Partow
  1 sibling, 0 replies; 3+ messages in thread
From: Ronny Pfannschmidt @ 2005-10-25 17:20 UTC (permalink / raw)
  To: Mark Nowhere; +Cc: pthreads-win32

Mark Nowhere wrote:

>Hi,
>    Just a quick question. I have a serial
>reader/writer thread and an network reader/writer
>thread. Basically I want the serial thread to, once
>new data has come in from the COMM port signal the
>network thread in some way to get it to pick up the
>data and send it over the network. Just not sure what
>I should use to get this effect?
>
>Options I can see are:
>
>Semaphores
>or 
>pthread_cond_signal/pthread_cond_wait stuff
>or 
>something else :)
>
>Many thanks for any advice
>
>Mark
>
>
>		
>___________________________________________________________ 
>To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
>
>  
>
why dont let the 1st thread [read serial] -> [write net],
and the 2nd [read net] -> [write serial]

Ronny

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Methods for "signalling" other threads?
  2005-10-25 15:56 Methods for "signalling" other threads? Mark Nowhere
  2005-10-25 17:20 ` Ronny Pfannschmidt
@ 2005-10-25 23:58 ` Arash Partow
  1 sibling, 0 replies; 3+ messages in thread
From: Arash Partow @ 2005-10-25 23:58 UTC (permalink / raw)
  To: pthreads-win32

Hi Mark,

I have a simple library that takes care of threaded producer consumer
oriented patterns. It lacks documentation, but the code itself is
pretty straight forward.

I think you would be most interested in the chain pattern, where you
would have one entity (threaded) or link in the chain so to speak
continually reading from the serial port (until some break condition
is met), that then dumps the data its read onto the prod-con link, the
next entity(also threaded) in the chain would try to reconstruct
frames from the data and the 3rd entity would process the frames and
do something useful. All these entities would be working
asynchronously and would only go to sleep when there was no more work
for them to be done. they would only wake up once there was some data
on link going into them.

A simple example would be the 2nd entity, the frame constructor, would
go into a conditional sleep when the data producer (the serial port
reader thread) was not getting anymore data off the serial port. The
3rd entity which would be the frame processor would go to sleep only
when it had finished processing all the outstanding frames created by
the frame constructor etc...


http://www.partow.net/programming/producerconsumer/index.html




Arash Partow
________________________________________________________
Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.
http://www.partow.net



Mark Nowhere wrote:

>Hi,
>    Just a quick question. I have a serial
>reader/writer thread and an network reader/writer
>thread. Basically I want the serial thread to, once
>new data has come in from the COMM port signal the
>network thread in some way to get it to pick up the
>data and send it over the network. Just not sure what
>I should use to get this effect?
>
>Options I can see are:
>
>Semaphores
>or 
>pthread_cond_signal/pthread_cond_wait stuff
>or 
>something else :)
>
>Many thanks for any advice
>
>Mark
>
>
>  
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-25 23:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-25 15:56 Methods for "signalling" other threads? Mark Nowhere
2005-10-25 17:20 ` Ronny Pfannschmidt
2005-10-25 23:58 ` Arash Partow

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