Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Installing Boost, mainly for threads

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Installing Boost, mainly for threads
23yrold3yrold
Member #1,134
March 2001
avatar

I've decided my next little learning project would be threads, and I have an idea for a simple project to try it. I decided to try the thread library from Boost but I'm stuck on installation (haven't used Boost before). Most of Boost is just headers but the thread library is on the list of the bits that must be built separately. And ... it don't say how. :( Anyone got any pointers? Do I just go to the root directory and "make configure" then "make install"? This is MinGW btw ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Speedo
Member #9,783
May 2008

Matthew Leverton
Supreme Loser
January 1999
avatar

Options you may find easier if you just need threads: Allegro 4.9 or pthreads.

Goalie Ca
Member #2,579
July 2002
avatar

I recommend staying away from boost threads. I did some work with them and it was a horrible mess using them, compiling them, packaging, etc.

pthreads i do recommend. they are the staple for threading and everyone learns pthreads in every university in the known universe.

-------------
Bah weep granah weep nini bong!

23yrold3yrold
Member #1,134
March 2001
avatar

I forgot about pthreads; I know I've heard that name before. I'll try those instead then. Thanks for reminding me.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

gnolam
Member #2,030
March 2002
avatar

There's also thread support built into SDL.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

GullRaDriel
Member #3,861
September 2003
avatar

I second pthreads for their simplicity of use.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Timorg
Member #2,028
March 2002

SDL does have threads, but the next major version of allegro will too. :D (No 3.4 isn't the next major version. :P)

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Arthur Kalliokoski
Second in Command
February 2005
avatar

Does pthreads allow you to lock threads to specific cores? (set process affinity etc.) I don't see anything about it in a brief Google session. I get the impression that this makes multithreading faster since there will be less code cache threshing.

They all watch too much MSNBC... they get ideas.

Goalie Ca
Member #2,579
July 2002
avatar

Typically we let the operating system control thread affinity. There is a lot of research going on at the operating system level where they try and come up with the optimal thread schedule. Unfortunately, academics in computer science like to believe there can be an oracle and that computations have no overhead (both in die and in time).

-------------
Bah weep granah weep nini bong!

Oscar Giner
Member #2,207
April 2002
avatar

Also, most GUI frameworks include threads support. So if you're using one of them, you can just stick with their own threading functions. In some cases they include some higher level functionality, so it's easier to get the job done (QT for example has QtConcurrent).

Thomas Fjellstrom
Member #476
June 2000
avatar

(QT for example has QtConcurrent).

Of course QtConcurrent isn't exactly what everyone is looking for. QtConcurrent is more for spawning of self running parallelizable jobs.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

axilmar
Member #1,204
April 2001

If you are under windows, you can download prebuilt boost binaries from Boost Pro.

Boost threads are excellent, by the way. Better than pthreads (because they are object-oriented).

SiegeLord
Member #7,827
October 2006
avatar

This is MinGW btw ...

BoostPro said:

Users of Other Compilers and Platforms

For now, users of other compilers and platforms should follow Boost's new Getting Started Guide. The configure script for Unix/Linux/FreeBSD/MacOS users that was previously linked here is now available as part of the regular Boost source distribution.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

axilmar
Member #1,204
April 2001

then the right command is:

bjam --build-type=complete gcc stage

according to the docs...

james_lohr
Member #1,947
February 2002

A couple of years ago I used Boost for some multithreading in a little networked game for communication threads. I don't recall any issues with installing it, I think I just followed a few online guides.

Anyway it worked great - it did exactly what it was supposed to and it was extremely easy to use once installed. I would certainly recommend it. It's just a bit shocking that you need an external library for multithreading in the first place... why don't you put C++ in the bin where it belongs and start using C#? :P

23yrold3yrold
Member #1,134
March 2001
avatar

Meh; I'm already using C#. I am in fact spending my evening trying to get DirectX swap chains working so my rendering doesn't suck. Bloody hell is it complicated ...

Anyway I'm rethinking Boost threads since pthreads isn't object oriented, and the code is messier than I'd like as a result. I'm looking into both. :P

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Timorg
Member #2,028
March 2002

axilmar said:

Boost threads are excellent, by the way. Better than pthreads (because they are object-oriented).

I don't see how object-oriented is better, its just different, and then limits it use to only C++. PThreads was designed to work in C, that happens to be usable from C++. This doesn't make it better or worse, just different. OO can be a drawback in many situations, when the problem being solved lends itself to procedural code. The fact that C++ can do both OO and procedural code is one of its strong points.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

axilmar
Member #1,204
April 2001

Timorg said:

I don't see how object-oriented is better, its just different, and then limits it use to only C++. PThreads was designed to work in C, that happens to be usable from C++. This doesn't make it better or worse, just different. OO can be a drawback in many situations, when the problem being solved lends itself to procedural code. The fact that C++ can do both OO and procedural code is one of its strong points.

Boost threads go a step beyond pthreads in many situations, thanks to object orientation and other nifty c++ tricks.

mEmO
Member #1,124
March 2001
avatar

I agree with axilmar and James, boost::threads are really neat and tidy compared to many of the other packages. And when doing multithreaded programming, you want all the neat and tidy you can get.

---------------------------------------------
There is only one God, and Connor is his son!
http://www.memocomputers.com
Happy birthday!

Arthur Kalliokoski
Second in Command
February 2005
avatar

why don't you put C++ in the bin where it belongs and start using C#?

I got the VC 2009 SP1 DVD image, and installed C# just to test it a bit. It wasn't hard to get a "Hello World" program running, what was hard was trying to figure out where the executable was, there was a "setup.exe" that caused errors on another computer, but the rest of it was text files. Maybe this other computer lacked some .NET thing, but the whole thing reminds me of that maiden aunt that says "Oh! You don't want to do that! You want to do this other thing.

They all watch too much MSNBC... they get ideas.

Timorg
Member #2,028
March 2002

@axilmar, I would have argued more against your point, but with how mEmO phrased it, I can't argue with you. (Assuming that you were both meaning the same thing.)

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Tobias Dammers
Member #2,604
August 2002
avatar

I got the VC 2009 SP1 DVD image, and installed C# just to test it a bit. It wasn't hard to get a "Hello World" program running, what was hard was trying to figure out where the executable was, there was a "setup.exe" that caused errors on another computer, but the rest of it was text files. Maybe this other computer lacked some .NET thing, but the whole thing reminds me of that maiden aunt that says "Oh! You don't want to do that! You want to do this other thing.

I'm not sure about 2009, but AFAIK it still works the same. Your C# program (provided you chose "Windows Forms Application" or "Console Application" - web applications work differently) is compiled into a .exe which resides in yoursolution/yourproject/bin/debug or yoursolution/yourproject/bin/release by default, depending on your configuration. For most applications, you don't need anything but the executable (and, obviously, a .NET runtime that fits the compiler version; for 2009, you need .NET 3.5 if I'm not mistaken). If you have an App.config, you'll need to distribute that, too; and if you reference other assemblies (class libraries) outside the .NET framework, you need to distribute the dlls too (they are all copied to the same folder as your executable by default).

You can also add a "deployment" project to create an installer which contains everything you need on the target machine, including .NET.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

23yrold3yrold
Member #1,134
March 2001
avatar

Oh good Lord, I need to install the Boost:thread library, but I need to compile it with their compiler Boost Build, but that's a source distro that opens its documentation with how to compile it, so I need to compile the compiler so I can use it to compile the library so I can use it with the compiler I had in the first place. I don't even care if that works at this point; my shenanigans detector is approaching critical levels and I'm afraid it'll blow. I need to find another way to do this or just go work on something else ...

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

anonymous
Member #8025
November 2006

If I'm not mistaken the common build tool for boost is bjam and I seem to remember that this was available as an exe (at least for Windows). I also seem to have built the threads library (but I haven't used it), so it must be possible with bjam.

 1   2 


Go to: