Changes between Initial Version and Version 1 of doc/lol/sys/thread.h


Ignore:
Timestamp:
Mar 15, 2015, 5:05:00 PM (4 years ago)
Author:
touky
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • doc/lol/sys/thread.h

    v1 v1  
     1[[TOC]]
     2= <lol/sys/thread.h> =
     3
     4View this file in the source browser: [browser:trunk/src/lol/sys/thread.h]
     5
     6== BaseThreadManager ==
     7
     8A virtual base class that manages threads.
     9Constructor has 2 parameters:
     10- `thread_count`: the maximum number of thread that can be created by this manager.
     11- `thread_min`: (''default'': `thread_count`) the minimun number of thread that must created by this manager.
     12
     13Thread 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.
     14
     15Each `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`.
     16
     17Some Implementations are available in this file : [browser:trunk/src/lol/sys/threadtypes.h]
     18
     19=== DefaultThreadManager ===
     20
     21An 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.
     22
     23
     24{{{
     25#!cpp
     26DefaultThreadManager* my_worker = new DefaultThreadManager(4, 0);
     27Ticker::Ref(my_worker);
     28
     29my_worker->AddJob(my_job);
     30
     31array<ThreadJob*> my_results
     32my_worker->GetWorkResult(my_results);
     33}}}