Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multi-threading

Started by I_Smell_Tuna Sep 25, 2005 at 8:55 PM 3 replies 550+ views
Original Post
I_Smell_Tuna
I_Smell_Tuna
I will be multi-threading the video game that I am currently developing to compliment the new multi-core processors that are coming to market. I just want to see how well others have been able to multi-thread their game, and what problems they ran into while doing so. Also, what threading library are you using, and why?
MaulingMonkey
MaulingMonkey
Quote:
Original post by I_Smell_Tuna
Also, what threading library are you using, and why?


I use the Boost Thread library, for it's clean and elegant interface (no casting to/from void pointers, works with functions functors member-functions and other such beasts), and the fact that I have the entire collection of Boost libraries installed anyways.

Boost homepage
Boost Threads documentation
Posts here I've made regarding it's use.
Link I found from said google search to one of my own posts with a crude example.
Telastyn
Telastyn
Over the weekend I doodled up an app using boost::thread as well. I'm using it because I was in the processing of learning other boost stuff, and it was on the list. Plus it promises portability, and common tools instead of trying to decide between the various threading options available.

Some thread problems run into:

- Simple synchronization: I assumed spawned threads would complete a task before the main thread ran a few other tasks. Easy enough to fix, but something that I'd guess is a standard beginner problem.

- Debugging intracies: I was having a problem with a spawned thread seg-faulting. The source I suspected was in the main thread, and some of the functions' returns. The standard practice is to set a breakpoint after the function in question, and take a look at the memory. Well the breakpoint stopped the main thread, but the other continued along happily until it segfaulted. Oops.


Generally, much less trouble than I expected even for the little project. My little learning code [extending networking code to provide inter-thread communication which emulates network communication] though likely involves far less problems than any sort of game.
I_Smell_Tuna
I_Smell_Tuna
I've read about some of the synchronizing problems like post-dated data and such, but I think I have a method that will solve this problem, and I think I know which sub systems need to be on same/separate threads. I have an X2 processor arriving Friday and I can't wait to do some multi-threaded programming on it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.