pthread_create -- no callback?

Evan Pollan evan_pollan@yahoo.com
Thu Nov 1 21:42:00 GMT 2001


Thanks for the help inre: getting a linkable pthreads library.  I have
1.3.5 installed and can link (using pthreads, pthread_cond, and pthread_mutex
calls).  However, I can't get pthread_create to call back into my startup
function...

I'm writing a QueueProcessor (producer-consumer pattern) that accepts
implementations of a Task interface.  The QueueProcessor is essentially
a thread pulling Tasks off an STL list + the cond/mutex code to handle the
wait/notify inter-thread communication.

Attached is the source for the QueueProcessor/Task and a test driver.  I've
also attached the output to illustrate the behavior.  Is there something I'm
doing wrong in the pthread_create call?  Notice that none of the messages in
the static driveQueue() call appear, nor anything from
QueueProcessor::processTasks().  The cond/mutex code
QueueProcessor::appendTask() and ::processTasks() is purely conjecture, as I
have no experience w/ POSIX thread wait/notify patterns (too used to the more
OO Java approach).

Ideas?  Any good online pthreads references/faq's that you'd recommend?


regards,
Evan


***
Here's the output:

------------------
QueueProcessor sucessfully constructed.
  --> pthread_create()
  <-- pthread_create()
QueueProcessor started successfully.
  --> joining against the queue thread...
  <-- join() returned...  This shouldn't happen!!!!
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
Appended Task[TestTask]
QueueProcessor shut down successfully.





--- Robert Collins <robert.collins@itdomain.com.au> wrote:
> From: "Robert Collins" <robert.collins@itdomain.com.au>
> To: "Evan Pollan" <evan_pollan@yahoo.com>,
> 	"Gerrit P. Haase" <cygwin@cygwin.com>
> Subject: Re: Cygwin && C++ POSIX threads support?
> Date: Sun, 11 Nov 2001 15:15:22 +1100
> 
> ----- Original Message -----
> From: "Evan Pollan" <evan_pollan@yahoo.com>
> To: "Gerrit P. Haase" <cygwin@cygwin.com>
> Sent: Sunday, November 11, 2001 3:12 PM
> Subject: Re: Cygwin && C++ POSIX threads support?
> 
> 
> > Great -- I'll pick up the kit tommorow over a more suitable
> > connection.  What's the preferred threading library?  POSIX?  Or
> > something a little more tuned to the Win32 env?
> >
> 
> Just link with no explicit library - the pthreads functions are in libc.
> 
> Rob
> 


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: QueueProcessor.h
URL: <http://cygwin.com/pipermail/cygwin/attachments/20011101/3fd01464/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: QueueProcessor.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20011101/3fd01464/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Driver.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20011101/3fd01464/attachment-0001.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list