delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/15/04:08:20

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3BF384BA.B2DD3ECB@cern.ch>
Date: Thu, 15 Nov 2001 10:02:50 +0100
From: "Lassi A. Tuura" <lassi DOT tuura AT cern DOT ch>
Organization: Northeastern University, Boston, USA
X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: Evan Pollan <evan_pollan AT yahoo DOT com>
CC: Robert Collins <robert DOT collins AT itdomain DOT com DOT au>, cygwin AT cygwin DOT com
Subject: Re: pthread_create -- no callback?
References: <20011114212317 DOT 56701 DOT qmail AT web21002 DOT mail DOT yahoo DOT com>

> That's all I needed.  My experience is very stale w/ C & C++, but why didn't I
> get at least a compilation warning when I passed the reference to the thread,
> rather than its value?

Because pthread_t == void *.  I am sure cygwin team would accept
a patch that consistently uses for example an opaque type[*].  I
suppose it might be a lot of simple-minded editing, but it would
help catch a lot of trivial errors.

But also make it a habit to check all those return values.  That
too will catch many trivial errors.

[*] Like this: `struct __pthread; typedef __pthread *pthread_t;'.
This is all the client side knows about `__pthread', hence it is
opaque.  The struct is defined in the implementation only.  Works
of course only if the implementation really uses structs.  From a
superficial inspection there's a 'pthread' class on cygwin side so
it would work, but I couldn't quite figure out where the code made
the transition from pthread_t == void * to pthread_t == pthread *.

Cheers,
//lat
-- 
Any coward can fight a battle when he's sure of winning; but
give me the man, who has pluck to fight when he's sure of
losing.  That's my way, sir; and there are many victories
worse than a defeat.  --George Eliot

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019