- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
parallel_task(IsThreadNumber$ + OpenGLthreadNumber, aFun, arg1, arg2); // with or without args
Where OpenGLthreadNumber is the thread number you desire.
intptr_t OpenGLthreadNumber = -1; // global scope
...
// after thread pool init, as main thread
OpenGLthreadNumber = qt_get_thread_num();
Some versions of OpenGL requires the process main thread to open the handle to GL, other versions do not.
You will have to decide as to if you want to use or not use the main thread for OpenGL.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the OpenGL context, I get errors from the drivers implementations...
I think some kind of binding based on indexing could be used ( below is a pseudo-code / sorry, I didn't try it to execute ):
...
class CMyTask : public tbb::task
{
public :
CMyTask( void ) { ... };
CMyTask( int iNumber )
{
m_iNumber = iNumber;
};
~CMyTask( void ){ ... };
tbb::task * execute()
{
if( m_iNumber == 1 )
{
...do task 1...
}
else
if( m_iNumber == 2 )
{
...do task 2...
}
...
return ( tbb::task * )NULL;
};
private:
int m_iNumber;
};
I agree that it doesn't look good but if it works and allows to do what you want why not?
By the way, I use a similar trick with OpenMP when I need to "bind" some processing to some OpenMP thread.
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page