delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
To: | cygwin AT cygwin DOT com |
From: | "Alex Vinokur" <alexvn AT connect DOT to> |
Subject: | pthreads, printf and cout |
Date: | Fri, 2 Jan 2004 19:57:37 +0200 |
Lines: | 71 |
Message-ID: | <bt4bed$u5f$1@sea.gmane.org> |
X-Complaints-To: | usenet AT sea DOT gmane DOT org |
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1106 |
Hi, Behavior of printf and cout in a program below is different : cout prints nothing. What is wrong? =================================== Windows 2000 Professional CYGWIN_NT-5.0 1.5.4(0.94/3/2) gcc version 3.3.1 (cygming special) =================================== ====== C++ code : foo.cpp : BEGIN ====== #include <stdio.h> #include <iostream> #include <pthread.h> #include <unistd.h> using namespace std; extern "C" void* Run(void *) { printf ("printf : Run Start\n"); cout << "cout : Run Start" << endl; sleep (3); printf ("printf : Run Finish\n"); cout << "cout : Run Finish" << endl; } int main () { pthread_t t1; pthread_create(&t1, NULL, Run, NULL); int errNum = pthread_join(t1, NULL); printf ("printf : errNum = %d\n", errNum); cout << "cout : errNum = " << errNum << endl; } ====== C++ code : foo.cpp : END ======== ====== Compilation & Run : BEGIN ====== $ g++ foo.cpp $ a printf : Run Start printf : Run Finish printf : errNum = 0 // cout prints nothing ====== Compilation & Run : END ======== -- ===================================== Alex Vinokur mailto:alexvn AT connect DOT to http://mathforum.org/library/view/10978.html news://news.gmane.org/gmane.comp.lang.c++.perfometer ===================================== -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |