#include "config.h"
#include "db.h"
Go to the source code of this file.
Functions | |
void | init_pool (int threds_count) |
Initialize thread pool. | |
void | add_task (void *(*start_routine)(void *), void *arg, bool prioritize=false) |
Add new task. | |
void | lock_let (let_stat *co) |
Locks letter statistics. | |
void | unlock_let (let_stat *co) |
Unlocks letter statistics. | |
void | wait_for_empty () |
Waits for empty task list. | |
void | empty_pool () |
Empty pool. |
void add_task | ( | void *(*)(void *) | start_routine, | |
void * | arg, | |||
bool | prioritize = false | |||
) |
Add new task.
This add task into our tasklist. Tasklist is checked by threads from our pool and whenever there is a free thread, it takes one task from this list and execute it.
References CHECK_PTR, and VWPRINTF.
Referenced by empty_pool(), find_it(), and find_it_thread().
void empty_pool | ( | ) |
Empty pool.
This function kills all threads in pool. It's quite easy.
References add_task(), kill_thread(), and wait_for_empty().
void init_pool | ( | int | threds_count | ) |
void lock_let | ( | let_stat * | co | ) |
Locks letter statistics.
This function locks statistics in out statistics tree. It's little bit tricky, cause I don't want to use mutexes for each letter, so I've got some weirder structure. We'll see how good idea it was.
References VWPRINTF.
void unlock_let | ( | let_stat * | co | ) |
Unlocks letter statistics.
This is opposite function to my lock_let() function. Both functions are little bit ugly. But I hope that they'll work.
void wait_for_empty | ( | ) |
Waits for empty task list.
This function should block until all tasks from tasklist are done.
References VPRINTF, and VWPRINTF.
Referenced by empty_pool(), and find_it().