Threads ??

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Threads ??

Postby palunix » Wed Jun 15, 2011 6:22 am

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

can i assign method to thread dyndamicly ??
palunix
 
Posts: 1
Joined: Sat May 01, 2010 3:32 pm

Re: Threads ??

Postby rlebeau » Thu Jun 16, 2011 1:15 am

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
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1562
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: Threads ??

Postby 2ffat » Thu Jun 16, 2011 5:52 am

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.
User avatar
2ffat
Forum Mod
Forum Mod
 
Posts: 433
Joined: Wed Jun 23, 2004 7:07 am
Location: South Hill, VA

Re: Threads ??

Postby S0mbre » Wed Jun 22, 2011 1:45 am

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.
S0mbre
Active Poster
Active Poster
 
Posts: 11
Joined: Wed Jun 08, 2011 9:36 pm

Re: Threads ??

Postby 2ffat » Wed Jun 22, 2011 10:55 am

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.
User avatar
2ffat
Forum Mod
Forum Mod
 
Posts: 433
Joined: Wed Jun 23, 2004 7:07 am
Location: South Hill, VA


Return to Technical

Who is online

Users browsing this forum: Bing [Bot] and 21 guests

cron