#include "config.h"
#include "helper.h"
#include <unistd.h>
#include "threads.h"

Functions | |
| void | init_pool (int threads_count) |
| Initialize thread pool. | |
| void | add_task (void *(*start_routine)(void *), void *arg, bool prioritize) |
| 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 * | kill_thread (void *) |
| This function kills current thread. | |
| void | empty_pool () |
| Waits for empty task list. | |
| 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 | ( | ) |
| 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().
1.5.7.1