#include <OgreThreads.h>
◆ CreateThread()
Creates and executes a new thread. 
unsigned long myOwnThread( ThreadHandle *ownThreadHandle ) { Should print "Hello from thread 50" printf( "Hello from thread %i", ownThreadHandle.getThreadIdx() ); return 0; } THREAD_DECLARE( myOwnThread );
int main() { ThreadHandle handle = CreateThread( THREAD_GET( myOwnThread ), 50, 0 ); WaitForThreads( 1, handle ); return 0; }
It is not possible to retrieve the return value of the function because it's not portable (and trying to emulate it induces to easy-to-cause memory leaks; as we're dealing with C functions + potential race conditions, not C++) 
- Parameters
- 
  
    | entryPoint | Function name of the entry point. VERY IMPORTANT: The entry point must be provided by THREAD_GET. Do not use a function directly, otherwise there will be memory leaks! |  | threadIdx | Optional index for this thread (ie. when you have many worker threads to work on a section of data. |  | param | Optional argument to be passed. |  
 
- Returns
- Handle to created thread. 
 
 
◆ CreateTls()
  
  | 
        
          | static bool Ogre::Threads::CreateTls | ( | TlsHandle * | outTls | ) |  |  | static | 
 
Allocates a Thread Local Storage handle to use. 
- Parameters
- 
  
    | outTls | [out] Handle to TLS. On failure this handle is set to OGRE_TLS_INVALID_HANDLE |  
 
- Returns
- True on success, false on failure. TLS allocation can fail if the system ran out of handles, or it ran out of memory. 
 
 
◆ DestroyTls()
  
  | 
        
          | static void Ogre::Threads::DestroyTls | ( | TlsHandle | tlsHandle | ) |  |  | static | 
 
Destroys a Thread Local Storage handle created with CreateTls. 
- Parameters
- 
  
    | tlsHandle | Handle to destroy |  
 
 
 
◆ GetTls()
  
  | 
        
          | static void* Ogre::Threads::GetTls | ( | TlsHandle | tlsHandle | ) |  |  | static | 
 
 
◆ SetTls()
  
  | 
        
          | static void Ogre::Threads::SetTls | ( | TlsHandle | tlsHandle, |  
          |  |  | void * | value |  
          |  | ) |  |  |  | static | 
 
 
◆ Sleep()
  
  | 
        
          | static void Ogre::Threads::Sleep | ( | uint32 | milliseconds | ) |  |  | static | 
 
Sleeps for a minimum of the specified time of milliseconds. 
Actual time spent sleeping may vary widely depending on OS and other variables. Do not feed 0. 
 
 
◆ WaitForThreads() [1/2]
  
  | 
        
          | static void Ogre::Threads::WaitForThreads | ( | const ThreadHandleVec & | threadHandles | ) |  |  | static | 
 
 
◆ WaitForThreads() [2/2]
  
  | 
        
          | static void Ogre::Threads::WaitForThreads | ( | size_t | numThreadHandles, |  
          |  |  | const ThreadHandlePtr * | threadHandles |  
          |  | ) |  |  |  | static | 
 
Waits until all threads are finished. 
- Parameters
- 
  
    | numThreadInfos | Number of ThreadHandle passed in the array as 'threadHandles' |  | threadHandles | Array of numThreadHandles or more ThreadHandle |  
 
 
 
The documentation for this class was generated from the following file: