Mail Archives: cygwin/2009/07/22/20:23:35
On Wed, Jul 22, 2009 at 08:05:21PM -0400, Joshua John Bialkowski wrote:
>I've spent the entire day scouring the internet for a solution to my problem, so
>I apologize if this has already been answered. If that is the case a pointer in
>the right direction would be appreciated.
>[snip]
>#include <iostream>
>using std::cout;
>
>#include <sstream>
>using std::stringstream;
>
>#include <string>
>using std::string;
>
>#include <windows.h>
>#include <process.h>
>
>
>void throwAnException() throw(int)
>{
> throw 5;
>}
>
>
>unsigned int __stdcall threadProc( void* ptr )
>{
> int id = *((int *)ptr);
> stringstream msgStrm (stringstream::in|stringstream::out);
> msgStrm << "Thread " << id << " says hello\n";
> string message = msgStrm.str();
>
> for(int i=0; i < 30; i++)
> {
> cout << message;
> cout.flush();
> Sleep(100);
> }
>
> try
> {
> throwAnException();
> }
> catch(int e)
> {
> cout << "caught: " << e << "\n";
> cout.flush();
> }
>
> return 0;
>}
>
>
>
>
>int main()
>{
> int nThreads = 3;
>
> int *nums = new int[nThreads];
>
> for(int i=0; i<nThreads; i++)
> {
> nums[i] = i;
> _beginthreadex( 0, 0, threadProc, nums+i, 0, 0 );
> }
>
> cout << "main thread exiting\n";
> cout.flush();
>
> Sleep(10000);
>
> cout << "main thread exiting\n";
> cout.flush();
>
> return 0;
>
>}
It looks like you're using pure windows code here, i.e., this would
be a mingw, "gcc -mno-cygwin" program. We don't support that here.
You might try the mingw mailing list for support.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -