multi core use? for send quickly....

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

multi core use? for send quickly....

Post by pakata »

working right??
this working...
but looks like still cut...
not smoothly...
i think criticaly algorithm error... ;;;
help~
(cpu ---> gpu)
for send quickly..

Code: Select all

DWORD WINAPI DrawThread(void *argdr);
DWORD drawThreadid;

Code: Select all

int threaddraw=0;
while(device->run() && driver)
{
     if(device->isWindowActive())
     {
        if(threaddraw++>=2)
        {
             CreateThread(NULL,0,DrawThread,NULL,0,&drawThreadid);
             threaddraw=0;
        }else{
              WaitForSingleObject(drawThread,INFINITE);
              driver->beginScene(timeForThisScene !=1,true,backColor);

              smgr->drawAll();
              guienv->drawAll();
              driver->endScene();
        }
     }
}

Code: Select all

DWORD WINAPI DrawThread(void *argdr)
{
    if(0==device) return 0;

     driver->beginScene(timeForThisScene !=1,true,backColor);

     smgr->drawAll();
     guienv->drawAll();
     driver->endScene();
}
[/code]
Last edited by pakata on Thu Nov 06, 2008 2:45 am, edited 2 times in total.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: multi core use? for send quickly....

Post by Seven »

if(threaddraw++>=1)


how many threads are you creating with this?

inside the loop, you are incrementing your variable and then seeing if it is more than 1, if it is, then you create another thread. every iteration of the main loop you are creating a thread?
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

Post by pakata »

thx;;;
fixed ;;
but.. thats copied error.. with think ;;;; lol
non online com -> online com;;;
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I fear that you're starting from the wrong end. First, check that your app is running at all, and see where the bottlenecks are. If you think that multi-processing will help, you should start with threading your helper libraries, such as sound, physics, or AI. For rendering speedup you should use advanced rendering techniques your GFX card and API offer, instead of putting data into the gfx card threaded - this will likely fail.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Yup. Multi-threading is not a magical technique for speeding up apps on multi-core machines.

You must - must - understand the implications: synchronisation, contention, deadlocks et al. You need to pay particular attention to resource ownership, especially at startup and shutdown.

This is not really a beginner's issue. ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

I'm afraid that you will need to read a tutorial on proper threading first, before you venture into this wacky world. Trust me, it's a different way of thinking about programming then just how to use the threading libs.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
pakata
Posts: 18
Joined: Tue Sep 23, 2008 11:51 pm
Location: korea rep of

Post by pakata »

um..
i see..

thx dudes...

i'll be back when problem solved @@;; with other problem.. lol
Post Reply