public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: satish <satishjadav@gmail.com>
To: pthreads-win32@sourceware.org
Subject: error C2678 and C2440
Date: Fri, 14 Dec 2007 13:29:00 -0000	[thread overview]
Message-ID: <57a6149b0712140110o229cf003h196271eaeb8b7c76@mail.gmail.com> (raw)

Hi,
I am porting my multi threading(using pthread) Linux project to
windows. The compiler is MS VC++ 2005.
I am using pthread-win32, downloaded from
"http://sourceware.org/pthreads-win32/".
For version, here is a line from pthread.h
"#define PTW32_VERSION 2,7,0,0"

The project compilation is almost done but I am  getting few errors
related to pthread.

A.:- Have a look on following code,
----------------------------------------------------------------
#define MAXTHREADS 1000
typedef struct {
	pthread_t id;
	pthread_mutex_t lock;
	pthread_cond_t cond;
} THREADLIST;

THREADLIST threads[MAXTHREADS];

1281 int thread_find() {
1282	int thread = -1;
1283	pthread_t self = pthread_self();
1284	pthread_mutex_lock(&threadlistlock);
1285	for (int i = 0; i < MAXTHREADS; i++) {
1286		if (threads[i].flags != THREAD_UNUSED && threads[i].id ==
self)				1287				thread = i;
1288			break;
1289		}
1290	}
1291	pthread_mutex_unlock(&threadlistlock);
1292	return thread;
1293 }
----------------------------------------------------------------

The error, I am getting is,

1>main.cpp(1286) : error C2678: binary '==' : no operator found which
takes a left-hand operand of type 'pthread_t' (or there is no
acceptable conversion)
1> c:\program files\microsoft visual studio
8\vc\platformsdk\include\guiddef.h(192): could be 'int operator
==(const GUID &,const GUID &)'
1> while trying to match the argument list '(pthread_t, pthread_t)'


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 = pthread_self();
54	return (ret);
55 }
----------------------------------------------------------------
Here, it gives error like,

1>main.cpp(53) : error C2440: '=' : cannot convert from 'pthread_t' to 'int'

Can you please tell me the reason behind these errors?
I will be very thankful to you.

Regards
Satish

             reply	other threads:[~2007-12-14  9:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14 13:29 satish [this message]
2007-12-14 13:47 ` Burkhardt, Glenn
2007-12-14 14:48   ` Peter Slacik
2007-12-16  4:06   ` Dennis Foreman
2007-12-14 13:49 ` Peter Slacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57a6149b0712140110o229cf003h196271eaeb8b7c76@mail.gmail.com \
    --to=satishjadav@gmail.com \
    --cc=pthreads-win32@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).