[Dev-C++] Thread function issue in a class.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Raghunath Marella.S <ms...@ya...> - 2002-07-22 09:17:11
|
Hi there,
I am facing a tricky problem. I have defined a class,
in which there are few funtions written for
implementing multithreading. I have a funtion named
"createThreads_()", which creates few threads. There
is another function declared in the class, "DWORD
WINAPI threadEntry_(LPVOID)". This function pointer
has been passed in the CREATETHREAD(..) call, which is
being raised as an error in VC++ compier.
It gives the error like,
_________________________
error C2664: 'CreateThread' : cannot convert parameter
3 from 'unsigned long (void *)' to 'unsigned long
(__stdcall *)(void *)'
None of the functions with this name in scope
match the target type
________________________
If I use any external function Thread Function(making
it as friend to the class) then compilation is
through, WHICH IS AS EXPECTED.
Similarly, if I make the "threadEntry_(..)" in class
as STATIC and use it in CREATETHREAD(..) call then
also compilation is through. But making STATIC wont
serve my purpose.
I can go ahead with using external function by making
int as friend to the class.
BUT HERE MY CONCERN IS WHY NOT POSSIBLE TO USE A
MEMBER FUNCTION AS THREAD FUNCTION?????
Will anyone pls clarify if you know the reason.
thanks in advance,
regards,
Raghunath Marella
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
|