This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: pthread & its bug
- From: "John \(Eljay\) Love-Jensen" <eljay at adobe dot com>
- To: "Mohsen Pahlevanzadeh" <mohsen at pahlevanzadeh dot org>, <gcc-help at gcc dot gnu dot org>
- Date: Fri, 23 Mar 2007 14:05:26 -0700
- Subject: RE: pthread & its bug
- References: <46046D9B.7030607@pahlevanzadeh.org>
Hi Mohsen,
Your inquiry is off topic for this forum. I do not say this to chastize you. I say it because you may get better / faster / more accurate information from a more appropriate forum that is pthread savvy.
There are a whole bunch of errors in your test source code.
For example, the pthread_create's third parameter takes a function pointer to a function that looks like:
void* task(void* ptr);
You are passing in a function pointer to a function that looks like:
void task(int* counter);
And you are casting the function pointer to a data pointer:
(void*)task1
That doesn't fit.
Another example, pthread_create's first parameter takes a pointer to a pthread_t. You are passing in a poiter to a pointer to a pthread_t. (And that pointer-to-a-pointer has not been allocated anywhere.)
That doesn't fit.
Work through all the mismatched data types, and then see where things end up. GCC helps you, by emitting a lot of warnings and errors. Heed them.
Don't forget to:
gcc test.c -lpthread
HTH,
--Eljay