From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28144 invoked by alias); 14 Dec 2007 13:29:55 -0000 Received: (qmail 28127 invoked by uid 22791); 14 Dec 2007 13:29:53 -0000 X-Spam-Check-By: sourceware.org Received: from atl-mxgateway.goodrich.com (HELO atl-mxgateway.goodrich.com) (12.129.98.69) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Dec 2007 13:29:35 +0000 Received: from atl-mxgateway.goodrich.com (unknown [127.0.0.1]) by atl-mxgateway.goodrich.com (Symantec Mail Security) with ESMTP id 6DA7E520570; Fri, 14 Dec 2007 08:29:32 -0500 (EST) X-AuditID: ac158622-acf4bbb000000696-be-4762853b96b8 Received: from GR-GWI-WEST-A.goodrich.com (gr-gwi-west-a.goodrich.com [170.126.245.4]) by atl-mxgateway.goodrich.com (goodrich.com) with ESMTP id C08C04DC003; Fri, 14 Dec 2007 08:29:31 -0500 (EST) Received: from nhc0ex01.goodrich.root.local (localhost [127.0.0.1]) by GR-GWI-WEST-A.goodrich.com (8.13.5/8.13.5) with ESMTP id lBEDSmOF010217; Fri, 14 Dec 2007 08:29:30 -0500 (EST) Received: from nhc0ex13.goodrich.root.local ([170.126.245.54]) by nhc0ex01.goodrich.root.local with Microsoft SMTPSVC(6.0.3790.1830); Fri, 14 Dec 2007 06:29:11 -0700 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: error C2678 and C2440 Date: Fri, 14 Dec 2007 13:47:00 -0000 Message-ID: <35737E0536AA3D4BA26F10F103C8ABF807964975@nhc0ex13.goodrich.root.local> In-Reply-To: <57a6149b0712140110o229cf003h196271eaeb8b7c76@mail.gmail.com> References: <57a6149b0712140110o229cf003h196271eaeb8b7c76@mail.gmail.com> From: "Burkhardt, Glenn" To: "satish" , X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2007/txt/msg00053.txt.bz2 Look at the declaration for 'pthread_t' in pthread.h. It's a structure, not a pointer or an integer: /* * Generic handle type - intended to extend uniqueness beyond * that available with a simple pointer. It should scale for either * IA-32 or IA-64. */ typedef struct { void * p; /* Pointer to actual object */ unsigned int x; /* Extra information - reuse count etc */ } ptw32_handle_t; typedef ptw32_handle_t pthread_t; I can't say I like this either. All other implementations I've seen use a pointer for pthread_t. It must be a Windows thing.=20 > -----Original Message----- > From: pthreads-win32-owner@sourceware.org=20 > [mailto:pthreads-win32-owner@sourceware.org] On Behalf Of satish > Sent: Friday, December 14, 2007 4:11 AM > To: pthreads-win32@sourceware.org > Subject: error C2678 and C2440 >=20 > Hi, > I am porting my multi threading(using pthread) Linux project=20 > to windows. The compiler is MS VC++ 2005. > I am using pthread-win32, downloaded from=20 > "http://sourceware.org/pthreads-win32/". > For version, here is a line from pthread.h "#define=20 > PTW32_VERSION 2,7,0,0" >=20 > The project compilation is almost done but I am getting few=20 > errors related to pthread. >=20 > A.:- Have a look on following code, > ---------------------------------------------------------------- > #define MAXTHREADS 1000 > typedef struct { > pthread_t id; > pthread_mutex_t lock; > pthread_cond_t cond; > } THREADLIST; >=20 > THREADLIST threads[MAXTHREADS]; >=20 > 1281 int thread_find() { > 1282 int thread =3D -1; > 1283 pthread_t self =3D pthread_self(); > 1284 pthread_mutex_lock(&threadlistlock); > 1285 for (int i =3D 0; i < MAXTHREADS; i++) { > 1286 if (threads[i].flags !=3D THREAD_UNUSED &&=20 > threads[i].id =3D=3D > self) 1287=09=09=09=09 > thread =3D i; > 1288 break; > 1289 } > 1290 } > 1291 pthread_mutex_unlock(&threadlistlock); > 1292 return thread; > 1293 } > ---------------------------------------------------------------- >=20 > The error, I am getting is, >=20 > 1>main.cpp(1286) : error C2678: binary '=3D=3D' : no operator found which > takes a left-hand operand of type 'pthread_t' (or there is no=20 > acceptable conversion) > 1> c:\program files\microsoft visual studio > 8\vc\platformsdk\include\guiddef.h(192): could be 'int=20 > operator =3D=3D(const GUID &,const GUID &)' > 1> while trying to match the argument list '(pthread_t, pthread_t)' >=20 >=20 > B.:- Another piece of code on which I am getting error is, > ---------------------------------------------------------------- > 50 unsigned long MY_pthreads_thread_id(void) > 51 { > 52 int ret; > 53 ret =3D pthread_self(); > 54 return (ret); > 55 } > ---------------------------------------------------------------- > Here, it gives error like, >=20 > 1>main.cpp(53) : error C2440: '=3D' : cannot convert from=20 > 'pthread_t' to 'int' >=20 > Can you please tell me the reason behind these errors? > I will be very thankful to you. >=20 > Regards > Satish >=20