Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Jan : Cost of CreateThread

www.cryer.info
Managed Newsgroup Archive

Cost of CreateThread

Subject:Cost of CreateThread
Posted by:"bora" (bora.aydem..@gmail.com)
Date:Tue, 22 Jan 2008 00:10:26 +0200

Hi,

I need to run a function AFunct in a thread, I wont need resume, start
synchronize etc. I can create a thread on the fly with

CreateThread(nil, 0, @AFunct, nil, 0, ID);

and with a critical section control shared resources. But i will be
creating maybe hundreds of threads per minute and each will take around
1-2 secs. Do I need thread pooling? For now CreateThread and forget
approach looks so simple and robust to implement I can't resist it :)
But is there an overhead (cpu time, cost, momery leaks etc) with
creating this amount of threads that will be created and destroyed heavily?

Thanks in advance

Bora

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive