pthread question - should this program run - does on Linux

Brian Keener bkeenerReMoVeAnTiSpAm@thesoftwaresource.com
Fri Mar 16 18:14:00 GMT 2007


I have been trying to get a grasp on some pthread usage starting with a couple 
simple programs.  I found this one and tried on Cygwin and didn't get what I 
expected so I tried in Linux and it worked there.  I know I have seen a lot on 
the archives about thread usage and that some things do not work (like stack 
size and stack addr) but I have also seen comments on if used properly then 
threads do work.  

I have compiled my simple program in Cygwin and Linux as 

g++ mythread_simple.cpp -o mythread_simple.exe

In Cygwin I when I compile I get this 

BrianK@atl-lt-5783 /usr/tmp
$ ./mythread_simple
Starting main now
Creating thread 0

0: hello world!
Creating thread 1
Creating thread 2
Creating thread 3
Creating thread 4

At this point I have to hit CTRL-C to break out.  And when I run in in linux I 
get 

Starting main now
Creating thread 0
Creating thread 1
Creating thread 2
Creating thread 3
Creating thread 4

0: hello world!

1: hello world!

2: hello world!

3: hello world!

4: hello world!

Which is what I would expect.  I have attached the program and my cygcheck log. 
Any information, confirmation or assistance greatly appreciated.

bk



-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythread_simple.cpp
Type: application/octet-stream
Size: 872 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20070316/434525c2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.log
Type: application/octet-stream
Size: 38288 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20070316/434525c2/attachment-0001.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list