This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthread question - should this program run - does on Linux


I got this (cygwin):

$ ./a
Starting main now
Creating thread 0

0: hello world!
Creating thread 1

1: hello world!
Creating thread 2

2: hello world!
Creating thread 3

3: hello world!
Creating thread 4

4: hello world!

then the program exit

On Fri, Mar 16, 2007 at 02:14:40PM -0400, Brian Keener wrote:
> 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
> 
> 
> 



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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]