 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Simon Elliott Guest
|
Posted: Mon Oct 04, 2004 9:30 pm Post subject: Portability, threads and BCB3 |
|
|
I'm developing some threaded C++ code which must be portable between
compilers but will only be run on windows platforms. If I were writing
C code I'd use beginthreadex. If I were writing for BCB only, I'd
inherit from TTHread. If I weren't writing for BCB3, I'd look at the
boost thread classes.
Any suggestions?
--
Simon Elliott http://www.ctsn.co.uk
|
|
| Back to top |
|
 |
Chris Uzdavinis (TeamB) Guest
|
Posted: Mon Oct 04, 2004 9:36 pm Post subject: Re: Portability, threads and BCB3 |
|
|
"Simon Elliott" <Simon at ctsn.co.uk> writes:
| Quote: | I'm developing some threaded C++ code which must be portable between
compilers but will only be run on windows platforms. If I were
writing C code I'd use beginthreadex. If I were writing for BCB
only, I'd inherit from TTHread. If I weren't writing for BCB3, I'd
look at the boost thread classes.
Any suggestions?
|
I would have suggested ACE, as it supports a lot of old compilers, but
I know it didn't support Borland until BCB4.
Sorry, no idea. BCB3 is really going to cause a lot of messy
problems. It was just before the inflection point of where many
standard language changes made their way into the compilers, and the
others you support came after.
Hardly an enviable position... :(
--
Chris (TeamB);
|
|
| Back to top |
|
 |
Simon Elliott Guest
|
Posted: Tue Oct 05, 2004 12:08 pm Post subject: Re: Portability, threads and BCB3 |
|
|
On 04/10/2004, Chris Uzdavinis (TeamB) wrote:
| Quote: |
Sorry, no idea. BCB3 is really going to cause a lot of messy
problems. It was just before the inflection point of where many
standard language changes made their way into the compilers, and the
others you support came after.
Hardly an enviable position...
|
A google search reveals that it's easy enough to make a TThread
lookalike. These have a static member which is the "real" thread
function run by beginthreadex(). The single void* argument is cast to a
TThread* and a virtual Run() method is called. Inherit from TThread,
override the virtual Run() method, job done.
However, ideally I want to be able to run several methods of a class,
each in their own threads. So I wondered about making a templated class
which took an object and a method as parameters, and executed the
method via a static member. Fortunately there are several examples and
fragments in newsgroups to give me ideas. Here's one:
<[url]http://www.google.com/groups?as_umsgid=7a8ogo%24eeq%242 (AT) elrond (DOT) sophos.c[/url]
om>
--
Simon Elliott http://www.ctsn.co.uk
|
|
| Back to top |
|
 |
Hendrik Schober Guest
|
Posted: Tue Oct 05, 2004 12:42 pm Post subject: Re: Portability, threads and BCB3 |
|
|
Simon Elliott <Simon at ctsn.co.uk> wrote:
| Quote: | I'm developing some threaded C++ code which must be portable between
compilers but will only be run on windows platforms. If I were writing
C code I'd use beginthreadex. If I were writing for BCB only, I'd
inherit from TTHread. If I weren't writing for BCB3, I'd look at the
boost thread classes.
Any suggestions?
|
I remember having ver bad problems with MT
in BCB3 due to its 'std::string' class not
beeing thread safe. In the end the update
to BCB4 turned our crashing app into a well
working one.
I suggest you do not use BCB3 for MT work.
Schobi
--
[email]SpamTrap (AT) gmx (DOT) de[/email] is never read
I'm Schobi at suespammers dot org
"Sometimes compilers are so much more reasonable than people."
Scott Meyers
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|