Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PThread * PThread::Create ( const PNotifier notifier,
INT  parameter = 0,
AutoDeleteFlag  deletion = AutoDeleteThread,
Priority  priorityLevel = NormalPriority,
const PString threadName = PString::Empty(),
PINDEX  stackSize = 10000 
) [static, inherited]

Create a simple thread executing the specified notifier. This creates a simple PThread class that automatically executes the function defined by the PNotifier in the context of a new thread.

Parameters:
notifier  Function to execute in thread.
parameter  Parameter value to pass to notifier.
deletion  Automatically delete PThread instance on termination of thread.
priorityLevel  Initial priority of thread.
threadName  The name of the thread (for Debug/Trace)
stackSize  Stack size on some platforms

Definition at line 2160 of file osutils.cxx.

References PThread::AutoDeleteThread.

Referenced by LauncherThread::Main(), PVideoOutputDevice_Window::Open(), and PVideoInputDevice_VideoForWindows::Open().

{
  PThread * thread = new PSimpleThread(notifier,
                                       parameter,
                                       deletion,
                                       priorityLevel,
                                       threadName,
                                       stackSize);
  if (deletion != AutoDeleteThread)
    return thread;

  // Do not return a pointer to the thread if it is auto-delete as this
  // pointer is extremely dangerous to use, it could be deleted at any moment
  // from now on so using the pointer could crash the program.
  return NULL;
}


Generated by  Doxygen 1.6.0   Back to index