<lol/sys/thread.h>

View this file in the source browser: trunk/src/lol/sys/thread.h

BaseThreadManager

A virtual base class that manages threads. Constructor has 2 parameters:

  • thread_count: the maximum number of thread that can be created by this manager.
  • thread_min: (default: thread_count) the minimun number of thread that must created by this manager.

Thread manager will create thread_min upon Start() and then create up to thread_count when job count is higher than the current number of threads.

Each TickGame(), if the number of job is higher than the current number of threads, it will stop enough threads so the current count goes down to thread_min.

Some Implementations are available in this file : trunk/src/lol/sys/threadtypes.h

DefaultThreadManager

An default implementation of the BaseThreadManager that is fed with non-specific job, perform them and store them upon completion so you can gather the results.

DefaultThreadManager* my_worker = new DefaultThreadManager(4, 0);
Ticker::Ref(my_worker);

my_worker->AddJob(my_job);

array<ThreadJob*> my_results
my_worker->GetWorkResult(my_results);
Last modified 2 years ago Last modified on Mar 15, 2015, 5:05:00 PM