From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21211 invoked by alias); 25 Oct 2005 23:58:20 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 21196 invoked by uid 22791); 25 Oct 2005 23:58:16 -0000 Received: from server13.dayanadns.com (HELO server13.dayanadns.com) (204.50.22.6) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 25 Oct 2005 23:58:16 +0000 Received: from [59.154.24.34] (helo=[172.18.15.217]) by server13.dayanadns.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.52) id 1EUYgG-00011R-AF for pthreads-win32@sources.redhat.com; Tue, 25 Oct 2005 16:58:12 -0700 Message-ID: <435EC68D.8040800@partow.net> Date: Tue, 25 Oct 2005 23:58:00 -0000 From: Arash Partow User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) MIME-Version: 1.0 To: pthreads-win32@sources.redhat.com Subject: Re: Methods for "signalling" other threads? References: <20051025155621.14418.qmail@web53101.mail.yahoo.com> In-Reply-To: <20051025155621.14418.qmail@web53101.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-SW-Source: 2005/txt/msg00128.txt.bz2 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 > > > >