Thanks a lot!. I will try...
Bernhard Holzmayer <holzmayer.bernhard@deadspam.com> wrote in message news:<1377326.iuDj2GbEUE@holzmayer.ifr.rt>...
> Nicrosoft wrote:
>
> > It seems that I can not use main() if I want to comile a exe
> > project with VDK support. For the default entry function is run()
> > for the new
> > thread. I want to creat threads in the main() when I need and to
> > destroy this thread when it is useless. Can I use the functions
> > for
> > thread like this?
> >
> > The following is the linux thread code.
> > ///////////////////////////////////////
> > void* thread_entry (void* data)
> > {
> > ... // do something.
> > return NULL;
> >
> > }
> >
> > int main (void)
> > {
> > pthread_t new_thread;
> > int data = 2;
> > pthread_create ();
> > pthread_join (new_thread, NULL);
> >
> > }
>
> Yes, you can create and destroy threads. However, you deal with lots
> of administration (execution time and memory
> allocations/deallocations). It might be preferable to create all
> threads in the beginning and then just "stop" and "restart" them as
> appropriate.
>
> What you need in any case is an administrating thread which takes
> the decisions about when creation or destruction of a thread have
> to take place and which initiates the work.
>
> To make things easy, just create a new project with VDK support,
> then on the VDK panel select a thread type and a boot thread which
> initially is running. Let its run() method serve as your main()
> function.
>
> Bernhard
Reply by Bernhard Holzmayer●April 26, 20042004-04-26
Nicrosoft wrote:
> It seems that I can not use main() if I want to comile a exe
> project with VDK support. For the default entry function is run()
> for the new
> thread. I want to creat threads in the main() when I need and to
> destroy this thread when it is useless. Can I use the functions
> for
> thread like this?
>
> The following is the linux thread code.
> ///////////////////////////////////////
> void* thread_entry (void* data)
> {
> ... // do something.
> return NULL;
>
> }
>
> int main (void)
> {
> pthread_t new_thread;
> int data = 2;
> pthread_create ();
> pthread_join (new_thread, NULL);
>
> }
Yes, you can create and destroy threads. However, you deal with lots
of administration (execution time and memory
allocations/deallocations). It might be preferable to create all
threads in the beginning and then just "stop" and "restart" them as
appropriate.
What you need in any case is an administrating thread which takes
the decisions about when creation or destruction of a thread have
to take place and which initiates the work.
To make things easy, just create a new project with VDK support,
then on the VDK panel select a thread type and a boot thread which
initially is running. Let its run() method serve as your main()
function.
Bernhard
Reply by Nicrosoft●April 23, 20042004-04-23
It seems that I can not use main() if I want to comile a exe project
with VDK support. For the default entry function is run() for the new
thread. I want to creat threads in the main() when I need and to
destroy this thread when it is useless. Can I use the functions for
thread like this?
The following is the linux thread code.
///////////////////////////////////////
void* thread_entry (void* data)
{
... // do something.
return NULL;
}
int main (void)
{
pthread_t new_thread;
int data = 2;
pthread_create ();
pthread_join (new_thread, NULL);
}