473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What are the threading options in C++

Hi all,

I'm just wondering what's the best option for threading in C++? I've
used pthreads and forking in C (the latter is not appropriate for my
situation now). All I want to do is run a function in a new thread, it's
a simple task, no interaction with other threads etc. so I don't have to
worry about deadlock, starvation and so on.

Thanks,

Lionel.
Jul 23 '05 #1
4 1241
Boost.Threads is a good threading library for C++:

http://www.boost.org/doc/html/threads.html

Lionel van den Berg wrote:
Hi all,

I'm just wondering what's the best option for threading in C++? I've
used pthreads and forking in C (the latter is not appropriate for my
situation now). All I want to do is run a function in a new thread, it's
a simple task, no interaction with other threads etc. so I don't have to
worry about deadlock, starvation and so on.

Thanks,

Lionel.

Jul 23 '05 #2
Lionel van den Berg <ch***********@hotmail.com> wrote in news:d086lp$ebb$1
@bunyip2.cc.uq.edu.au:
Hi all,

I'm just wondering what's the best option for threading in C++? I've
used pthreads and forking in C (the latter is not appropriate for my
situation now). All I want to do is run a function in a new thread, it's
a simple task, no interaction with other threads etc. so I don't have to
worry about deadlock, starvation and so on.


Threading is off-topic in comp.lang.c++. The Standard makes no mention of
threading. You're in OS-specific land and should ask in an OS-specific
newsgroup. Having said that, you may wish to go look in Boost. As I
recall, they have a threading class... (http://www.boost.org)
Jul 23 '05 #3
Andre Kostur wrote:
Lionel van den Berg <ch***********@hotmail.com> wrote in news:d086lp$ebb$1
@bunyip2.cc.uq.edu.au:

Hi all,

I'm just wondering what's the best option for threading in C++? I've
used pthreads and forking in C (the latter is not appropriate for my
situation now). All I want to do is run a function in a new thread, it's
a simple task, no interaction with other threads etc. so I don't have to
worry about deadlock, starvation and so on.

Threading is off-topic in comp.lang.c++. The Standard makes no mention of
threading.


My apologies.
You're in OS-specific land and should ask in an OS-specific
newsgroup. Having said that, you may wish to go look in Boost. As I
recall, they have a threading class... (http://www.boost.org)


Thanks.

Lionel.
Jul 23 '05 #4
Andre Kostur wrote:
Lionel van den Berg <ch***********@hotmail.com> wrote in news:d086lp$ebb$1
@bunyip2.cc.uq.edu.au:

Hi all,

I'm just wondering what's the best option for threading in C++? I've
used pthreads and forking in C (the latter is not appropriate for my
situation now). All I want to do is run a function in a new thread, it's
a simple task, no interaction with other threads etc. so I don't have to
worry about deadlock, starvation and so on.

Threading is off-topic in comp.lang.c++. The Standard makes no mention of
threading. You're in OS-specific land and should ask in an OS-specific
newsgroup. Having said that, you may wish to go look in Boost. As I
recall, they have a threading class... (http://www.boost.org)


Actually it's not /that/ off-topic, since IIRC threading and concurrency
is planned to be supported by C++0x.

--
Matthias Kaeppler
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Andrae Muys | last post by:
Found myself needing serialised access to a shared generator from multiple threads. Came up with the following def serialise(gen): lock = threading.Lock() while 1: lock.acquire() try: next...
3
by: Suhail Salman | last post by:
Dear All, i got the following error message in an applications that opens 13 threads and all of them calling a stored procedure which retreieves data from SQLServer and fills them to a table the...
8
by: Yatharth | last post by:
Hi, I m new to threading and i have successfully runed threading but i could display value on my web page ,but its working in code behind when i see it through debugger,plzzzzzzz help me here...
3
by: Eric Sabine | last post by:
OK, I have an app that when it loads, it calls a sub which loads a dataset from a web service. I spin the call on another thread so the user doesn't get an unresponsive screen. The problem ensues...
17
by: One Handed Man \( OHM - Terry Burns \) | last post by:
Assumes a Form with a Panel on it., Does the Mutex have to be within the address of a thread start address ? Cheers - OHM '----------- *************** ---------------- Private...
1
by: mburghdorf | last post by:
I am currently working on a vb.net program that interacts with autocad. The thread processes a building that was created within the program and comes up with a price. I then after the job has been...
3
by: JMax | last post by:
Hello! I have a C# ASPX page that displays a large amount of information. The software loops through 500 lines of code (and some of the 500 lines are looped multiple times, in a loop)....
2
by: VMI | last post by:
I'm filling up a gridview and the underlying datatable has about 30,000 records, so it takes some time before I can see the page again with the records on the gridview. Is there any type of...
167
by: darren | last post by:
Hi I have to write a multi-threaded program. I decided to take an OO approach to it. I had the idea to wrap up all of the thread functions in a mix-in class called Threadable. Then when an...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.