Threads ??

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Post Reply
palunix
Posts: 1
Joined: Sat May 01, 2010 3:32 pm

Threads ??

Post by palunix »

what is the easy way to programe threads using C++builder2010 ...

can i assign method to thread dyndamicly ??
rlebeau
BCBJ Author
BCBJ Author
Posts: 1759
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA
Contact:

Re: Threads ??

Post by rlebeau »

palunix wrote:what is the easy way to programe threads using C++builder2010 ...
Look at the VCL's TThread class.
palunix wrote:can i assign method to thread dyndamicly ??
TThread has a virtual Execute() method that you can override.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
2ffat
Forum Mod
Forum Mod
Posts: 452
Joined: Wed Jun 23, 2004 7:07 am
Location: South Hill, VA
Contact:

Re: Threads ??

Post by 2ffat »

In addition, there has been a series of articles in recent Developer's Journals that talks about this in depth. You will need a subscription, though.
James P. Cottingham

Look at me still talking
when there is science to do.
S0mbre
Active Poster
Active Poster
Posts: 11
Joined: Wed Jun 08, 2011 9:36 pm

Re: Threads ??

Post by S0mbre »

Personally I use the JvThread component and other thread components from the JVCL distribution. They are easier to use and provide some advanced features, such as a thread progress dialog that may be used to show the progress of a thread and give the ability to pause or stop the thread.

I have also been wondering if boost::thread can be used safely in C++Builder projects. From what one reads in the boost documentation, boost::threads provide lots of inbuilt functionality that the VCL TThread does not, such as semaphores, critical sections, thread synchronization and queuing, mutex scopes etc etc... I've tried to use them in some test projects, they did compile but didn't work. So now I stick to TThread for simple needs and JvThread in more complicated cases. But I'd like to hear if someone has implemented boost::thread in C++Builder projects.
User avatar
2ffat
Forum Mod
Forum Mod
Posts: 452
Joined: Wed Jun 23, 2004 7:07 am
Location: South Hill, VA
Contact:

Re: Threads ??

Post by 2ffat »

The boost library has been included in C++Builder since 2009 (I believe) but I notice that in C++Builder 2010, the thread library is restricted and "this could cause problems." I don't know about C++Builder XE.
James P. Cottingham

Look at me still talking
when there is science to do.
Post Reply