Board index » delphi » 2.0 Multithreading

2.0 Multithreading

Anybody get multithreading working?  I have read the sparse documentation
and checked the demo and am totally confused.  Where in the
demo are beginthread an endthread?  There is no demonstration
of these functions!
 

Re:2.0 Multithreading


Quote
Keith Patrick <kpatr...@basil.stthom.edu> wrote:
>Anybody get multithreading working?  I have read the sparse documentation
>and checked the demo and am totally confused.  Where in the
>demo are beginthread an endthread?  There is no demonstration
>of these functions!

The threading is only pointer to functions.  If you want to loop in
the function the go ahead, but the thread ends when you exit the
function.

Iman L. Crawford
ilcrw...@sage-inc.com

Re:2.0 Multithreading


I also had hard times trying to use threads.
As far I as I understood, beginthread is called when
you create your TThread object (it uses its Execute
method to do actual thread work). When Execute finishes,
thread terminates automatically (if FreeOnTerminate=true).
Browsing trough the classes unit source text helped to
some extend, but not much.
Let me know if you'll find any descent info on threads in
Delphi.
The thing I'm particularry interested in is the possibility
of creating thread that automatically cleans up all the data allocated
by the thread without memory loss: just like if you run main process
and it terminates without cleanup, Windows takes care of it; it's not
true with the threads started by the main process: since threads are
mapped into the main process address space, any data allocated my the
thread stays alive until main process is finished :(, and I need the
ability (I really do) to use threads with local data deallocated when
the thread is terminated in any way.
It's my understanding that using "threadvar" declaration instead of "var"
would help, but what's about dynamically allocated memory? I can declare
pointer to the array as a threadvar, but not dynamically allocated array.

Borland should've taken much more care of it's documentation...

Dmitry

In article <4i7gpo$...@cloner4.netcom.com>,
   Keith Patrick <kpatr...@basil.stthom.edu> wrote:

Quote
>Anybody get multithreading working?  I have read the sparse documentation
>and checked the demo and am totally confused.  Where in the
>demo are beginthread an endthread?  There is no demonstration
>of these functions!

Other Threads