Logo Search packages:      
Sourcecode: ardour version File versions

void Glib::ThreadPool::set_max_threads ( int  max_threads  ) 

Sets the maximal allowed number of threads for the pool. A value of -1 means that the maximal number of threads is unlimited. Setting max_threads to 0 means stopping all work for pool. It is effectively frozen until max_threads is set to a non-zero value again.

A thread is never terminated while it is still running. Instead the maximal number of threads only has effect for the allocation of new threads in ThreadPool::push(). A new thread is allocated whenever the number of currently running threads in the pool is smaller than the maximal number.

Parameters:
max_threads A new maximal number of threads for the pool.
Exceptions:
Glib::ThreadError An error can only occur when a new thread couldn't be created.

Definition at line 173 of file threadpool.cc.

{
  GError* error = 0;
  g_thread_pool_set_max_threads(gobject_, max_threads, &error);

  if(error)
    Glib::Error::throw_exception(error);
}


Generated by  Doxygen 1.6.0   Back to index