Hi Koduri, I think perhaps you should take a few steps back from the approach you are taking a learn a bit more about the basics of threading, performance profiling and optimization before you dive into implement threading to try and tackle what you perceive to be the way to solve problem.
So please for now forget about threading and ask the simpler question, what performance I am looking to achieve and what performance I am achieve right now with simple straight forward code. Then ask the question what the bottlenecks are, you can even ask the community about how to address them. Also on the topic of threading there are lots of resoureces out there on the web that will teach you are about threading, it's a rather subtle topic with lots of little things you have to think about that you don't when you work single threaded, so you really have to invest time into learning about it. Robert. On 19 September 2012 07:44, Koduri Lakshmi <[email protected]> wrote: > Hi robertosfield and hybr, > > Thanks a lot for the nice help. > > My develop environment is windows XP 32 bit with SP3. On 32 bit machines the > code works well. > > When I run on Win - 7 Ultimate 64 bit then I am getting run time error some > times. I dont have development environment on 64 bit machine. I don't know > how to provide stack trace on this testing machine. > > > > I modified my code such that the thread has only reading statement. I want to > run all threads simultaneously (so reading will be fast). I dont want sysnc > of threads. > > Here is my modified code. > > > Code: > //Globles > > struct ModelObj > { > int id; > }; > ModelObj obj[NUM_OF_MODELS]; > > Model model;//OBJ OF MODEL HANDLING CLASS > > HANDLE T[NUM_OF_MODELS]; > CWinThread *pThread[NUM_OF_MODELS]; > > UINT ThreadProc1(LPVOID lpvoid) > { > ModelObj *temp = (ModelObj*)lpvoid; > > //model.mtForMarker[temp->id] = new osg::MatrixTransform; > > //model.modelSwitch->addChild(model.mtForMarker[temp->id].get()); > > model.modelForMarker[temp->id] = > osgDB::readNodeFile(model.fileNames[temp->id]); > > if(model.modelForMarker[temp->id]) > { > > model.mtForMarker[temp->id]->addChild(model.modelForMarker[temp->id].get()); > > > //model.mtForMarker[temp->id]->addChild(model.sound_root.get()); > // model.mtForMarker[temp->id]->setUpdateCallback( > model.soundCB.get() ); > } > > > > return 0; > } > > > > > > In main > > > Code: > Code: > ......... > > > for(int i=0;i<NUM_OF_MODELS;i++) > { > obj[i].id=i; > > } > > strcpy(model.fileNames[0],"osg_01.osg"); > strcpy(model.fileNames[1],"osg_02.OSG"); > strcpy(model.fileNames[2],"osg_03.OSG"); > > DWORD ThreadId[NUM_OF_MODELS]; > for(int i=0;i<NUM_OF_MODELS;i++) > { > model.mtForMarker[i] = new osg::MatrixTransform; > > model.modelSwitch->addChild(model.mtForMarker[i].get()); > > > model.mtForMarker[i]->addChild(model.sound_root.get()); > model.mtForMarker[i]->setUpdateCallback( > model.soundCB.get() ); > > //pThread[i]=new CWinThread; > std::cout<<"Thread: "<<i<<std::endl; > pThread[i] = AfxBeginThread (ThreadProc1, > (LPVOID)&obj[i]); > > pThread[i]->m_bAutoDelete=FALSE; > > } > > for (int j = 0; j < NUM_OF_MODELS; j ++) > { > T[j] = pThread[j]->m_hThread; > } > > ::WaitForMultipleObjects(NUM_OF_MODELS, T, TRUE, > INFINITE); > > for (int j = 0; j < NUM_OF_MODELS; j ++) > { > delete pThread[j]; > } > > > > > > Once I tried to use binary formats. But when compared to OSG files its size > is huge. So I stopped. I will try once again. (I am changing textures > dynamically. Is it possible with binary formats?) > > Can you please guide me how to solve this problem? > > > ... > > Thank you! > > Cheers, > Koduri > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=50181#50181 > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

