Logo Search packages:      
Sourcecode: ardour version File versions

Thread * Glib::Thread::create ( const sigc::slot< void > &  slot,
bool  joinable 
) [static]

Creates a new thread with the priority THREAD_PRIORITY_NORMAL. If joinable is true, you can wait for this thread's termination by calling join(). Otherwise the thread will just disappear, when ready.

The new thread executes the function or method slot points to. You can pass additional arguments using sigc::bind(). If the thread was created successfully, it is returned, otherwise a ThreadError exception is thrown.

Parameters:
slot A slot to execute in the new thread.
joinable Should this thread be joinable?
Returns:
The new Thread* on success.
Exceptions:
Glib::ThreadError 

Definition at line 78 of file thread.cc.

{
  // Make a copy of slot on the heap
  sigc::slot_base *const slot_copy = new sigc::slot<void>(slot);

  GError* error = 0;

  GThread *const thread = g_thread_create(
      &call_thread_entry_slot, slot_copy, joinable, &error);

  if(error)
  {
    delete slot_copy;
    Glib::Error::throw_exception(error);
  }

  return reinterpret_cast<Thread*>(thread);
}


Generated by  Doxygen 1.6.0   Back to index