Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Multi Threading

Author
Message
Green Fox
19
Years of Service
User Offline
Joined: 9th Jun 2005
Location:
Posted: 31st Jul 2009 08:57
How is it done in C++. I can't find a solution. I want to make a program that runs AR logic on one core and game logic on another core. How do I do that? Is it two .cpp running at the same time? How do I define that? Is there a tutorial or book some one can refer me to?
Amnzero
15
Years of Service
User Offline
Joined: 1st Aug 2009
Location:
Posted: 1st Aug 2009 19:01
Yes when they put together the GDK a sad thing they forgot to take into account is Multi Threading, and OOP design. Well of course the language itself give you both of those options but the way that the GDK is implimented makes both of them a little difficult.

[ Amnzero ]
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 2nd Aug 2009 11:32


I believe that should help. Probably got the _beginthread arguments wrong, though...

AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 2nd Aug 2009 15:47
You can also try OpenMP which is part of VSC++

Amnzero
15
Years of Service
User Offline
Joined: 1st Aug 2009
Location:
Posted: 3rd Aug 2009 10:02
Quote: "#include <process.h>

void AThread(void *p)
{
//thread stuff runs here
}

void AnotherThread(void *p)
{
//another thread
}

//now, starting these threads...
_beginthread(AThread, 1024);
_beginthread(AnotherThread, 1024);"


Yes the correct syntax for _beginthread is below



[ Amnzero ]
Amnzero
15
Years of Service
User Offline
Joined: 1st Aug 2009
Location:
Posted: 3rd Aug 2009 10:08
Oh yeah and the finction you call with _beginthread must call _endthread

OpenMP looks a little easier to use, but I don't know if I trust it.

[ Amnzero ]

Login to post a reply

Server time is: 2024-10-01 08:38:41
Your offset time is: 2024-10-01 08:38:41