Threads in c++.

H

Harsha

Hi.....

I need to develop a program for my academic project using
graphics in c++. I want to do it using THREADS so that it can have
mouse interface while accepting input...I want to know how to
implement threads in c++, and im using TURBO C++ 3.0
compiler....Please help....

Thank you.....
 
B

brekehan

Hi.....

I need to develop a program for my academic project using
graphics in c++. I want to do it using THREADS so that it can have
mouse interface while accepting input...I want to know how to
implement threads in c++, and im using TURBO C++ 3.0
compiler....Please help....

Thank you.....

You need to look at documentation for your operating system. Much
information on multithreaded programming on windows is available on
MSDN and much information on multithreading on Linux is available by
man pthread or googling. Multithreaded programming is not part of the
standard C++ library and is off topic here. your question is also too
general to give a good answer in a newsgroup post format, an entire
book would be required.
 
V

Victor Bazarov

Harsha said:
Hi.....

I need to develop a program for my academic project using
graphics in c++. I want to do it using THREADS so that it can have
mouse interface while accepting input...I want to know how to
implement threads in c++, and im using TURBO C++ 3.0
compiler....Please help....

If you're on Windows, see 'CreateThread' API function and/or
'beginthread' (POSIX?), but neither of them is standard C++, they
are platform-specific. C++ language is *not* thread-aware.

V
 
J

Jim Langston

Harsha said:
Hi.....

I need to develop a program for my academic project using
graphics in c++. I want to do it using THREADS so that it can have
mouse interface while accepting input...I want to know how to
implement threads in c++, and im using TURBO C++ 3.0
compiler....Please help....

Threads are OT for this newsgroup. I can suggest
comp.programming.threads
but this is a rather low level question even for them.

I would suggest you first google for some thread source code in C++ for your
compiler, download and play with it then ask in comp.programming.threads
when you get stuck.
 
G

Gianni Mariani

Harsha said:
Hi.....

I need to develop a program for my academic project using
graphics in c++. I want to do it using THREADS so that it can have
mouse interface while accepting input...I want to know how to
implement threads in c++, and im using TURBO C++ 3.0
compiler....Please help....

Best way to do threads in C++ is to use some-one else's work. boost or
Austria C++ provide interfaces to threading.
 
J

James Kanze

Threads are OT for this newsgroup.

Could you point to something in the charter which supports that.
Discussion of a system specific threading API is off topic, but
that's really not a good way to go anyway. It's far better use
a portable abstraction layer over the system API, something like
Boost::threads.

Beyond that, general questions about threaded code are on topic,
even if the standard doesn't (yet) mention the word threads.
 
W

werasm

Best way to do threads in C++ is to use some-one else's work. boost or
Austria C++ provide interfaces to threading.

I've noticed the OP uses Turbo 3.0. That's quite an old compiler.
I wonder if boost supports it. I'm saying wonder because I've not
in particular looked at boost's implementation. I've noticed that
boost does not mention the compiler in its regression test summary:

http://engineering.meta-comm.com/boost-regression/CVS-HEAD/developer/thread.html

Regards,

Werner
 
D

Default User

Harsha said:
Hi.....

I need to develop a program for my academic project using
graphics in c++. I want to do it using THREADS so that it can have
mouse interface while accepting input...I want to know how to
implement threads in c++, and im using TURBO C++ 3.0
compiler....Please help....

That's an ancient compiler, waaaay pre-standard. I first used that in
1992. I'd suggest moving up if at all possible.





Brian
 
C

coal

Could you point to something in the charter which supports that.
Discussion of a system specific threading API is off topic, but
that's really not a good way to go anyway. It's far better use
a portable abstraction layer over the system API, something like
Boost::threads.

If Boost::threads is on topic (and I think it should be), it is kind
of hard to rule out specific threading APIs, since the guts of the
boost library deal with that. It seems like it would be
a lot simpler if we draw the line at C++. If a post doesn't have
any clear connection to C++, I think its reasonable to ask why they
posted to this newsgroup.

Brian Wood
Ebenezer Enterprises
 
H

Howard Hinnant

James Kanze said:
Beyond that, general questions about threaded code are on topic,
even if the standard doesn't (yet) mention the word threads.

Thanks James.

Announcement: The latest working draft of the C++ standard now mentions
the word "thread":

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2369.pdf

(the next draft, available in just a few days, will say more, and the
draft after that will say more, etc.)

I hereby declare the subject of multithreading, as it relates to C++, to
be on topic for comp.lang.c++. :)

I know it will be a struggle for people to find something to discuss
besides the topicality of multithreading. But if we pull together, I
believe we can get through these trying times.

-Howard
 
J

James Kanze

I've noticed the OP uses Turbo 3.0. That's quite an old compiler.
I wonder if boost supports it. I'm saying wonder because I've not
in particular looked at boost's implementation. I've noticed that
boost does not mention the compiler in its regression test summary:

It's another question, but of course, the OP really should
upgrade. The language which Turbo 3.0 supported is very little
like the language we discuss here.
 
J

James Kanze

If Boost::threads is on topic (and I think it should be), it is kind
of hard to rule out specific threading APIs, since the guts of the
boost library deal with that.

Discussion of how to implement the Boost library on a particular
system wouldn't be on topic, I don't think. But Boost tries to
be (and generally is) fairly portable; you can use the Boost
library on Windows or on Unix.
It seems like it would be a lot simpler if we draw the line at
C++. If a post doesn't have any clear connection to C++, I
think its reasonable to ask why they posted to this newsgroup.

The problem is defining C++. The classical criterion is that if
the answer would be the same in all languages, but would vary
from one platform to the next, it's off topic, but if the answer
would be different in other languages, but be the same for most
implementations of C++, it's on topic.

There are definitely threading issues which are purely C++, and
are on topic here (e.g. synchronization requirements for the
initialization of a local static variable). There are
definitely threading issues which aren't (e.g. anything
concerning a platform specific API). Most of the threading
issues fall somewhere inbetween---there are a lot, for example,
which would be the same for more or less any language, but which
are also platform independent. Over all, I'm in favor of
accepting them, if for no other reason than that the standards
committee has decided to add threading to the next version of
C++, and is actively discussing them as well.

In this particular case, of course, the Boost interface is
certainly relevant---it's independent of the system you're using
(as long as you're under Windows or Unix, at least), and it is
definitly only a C++ issue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top