Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

For what reason is the parameter LPVOID lpParameter used in CreatThread() ?

152 views
Skip to first unread message

Johan Machielse

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
Hello,

Right now, I'm going to write a multithreading application. I work with the
function CreateThread. I know the meaning of all arguments, but what is the
meaning of the fourth parameter (LPVOID lpParameter)? For what reason is it
used and what value do I have to give this parameter?

Thank you,

Johan Machielse

Hari Ananth

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to

Johan Machielse wrote in message <#J0Ed1Im$GA.87@cppssbbsa04>...
Hi,
A NULL value can be passed if no parameter is required to be passed
to the thread function.
Otherwise a structure can be passed by passing address of the structure
and this structure can be type casted to a structure pointer
inside the thread function and used.

--Hari ananth

Farhan Noor Qureshi

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
You can pass information to the newly created thread.

"Hari Ananth" <ha...@india.genisys.co.uk> wrote in message
news:uWfKGKJm$GA....@cppssbbsa02.microsoft.com...
:
: Johan Machielse wrote in message <#J0Ed1Im$GA.87@cppssbbsa04>...

:
:

John Fisher

unread,
Mar 28, 2000, 3:00:00 AM3/28/00
to
Hi,
One common reason for using that paramater is to pass an object's "this" pointer to
a static thread starting function for a class. In this situation, the parameter
allows you to encapsulate a thread inside a class (since the thread function itself
can't be a non-static class member).

John

"Johan Machielse" <JohanMa...@netscape.net> wrote in message
news:#J0Ed1Im$GA.87@cppssbbsa04...

0 new messages