#include "smp.h"#include <stdio.h>#include <time.h>#include <errno.h>#include <stdlib.h>#include <sys/sysinfo.h>#include <list.h>

Go to the source code of this file.
Namespaces | |
| namespace | TBCI |
Classes | |
| class | TBCI::cback |
Defines | |
| #define | _GNU_SOURCE 1 |
| #define | NEED_SMP_DECLS 1 |
| #define | MAX_THREADS 160 |
| #define | TCHK(x) x |
| #define | ERRDECL |
| #define | _cpu_relax() |
| #define | POLL_REP 320 |
| #define | POLL_REPS (POLL_REP/16) |
Functions | |
| static int | TBCI::detect_num_cpu () |
| static int | TBCI::loadavg () |
| void | TBCI::thread_reg_callback (cbackfn ctor, cbackfn dtor, void *parm) |
| void | TBCI::thread_dereg_callback (cbackfn ctor, cbackfn dtor, void *parm) |
| void | TBCI::pthr_cond_signal_mutex (pthread_cond_t *cond, pthread_mutex_t *mut, volatile int *done) |
| int | TBCI::pthr_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mut, volatile int *valptr) |
| void | TBCI::lina_err (struct thr_ctrl *tc) |
| void | TBCI::lina_empty (struct thr_ctrl *dummy) |
| void * | TBCI::empty_thread (void *dummy) |
| void | TBCI::pthread_mutex_bug_abort (struct thr_ctrl *tc, int err, const char *where) |
| void * | TBCI::lina_thread (void *thr) |
| int | TBCI::init_threads (const int thr=0) |
| void | TBCI::bind_threads (bool bind_main=false) |
| Set scheduling affinity of threads Rather than letting the OS decide which CPU a thread runs on, this makes sure a thread can only run on one CPU. | |
| void | TBCI::free_threads () |
| Should be called on shutdown for multithreaded programs. | |
| void | TBCI::_thread_start_off (const int thr_no, thr_job_t job, const unsigned long off, const unsigned long sz, va_list vl) |
| void | TBCI::thread_start_off (const int thr_no, thr_job_t job, const unsigned long offset, const unsigned long sz,...) |
| void | TBCI::thread_start (const int thr_no, thr_job_t job, const unsigned long sz,...) |
| last arg must be (void*)0 ! | |
| void | TBCI::thread_wait (const int) |
| void * | TBCI::thread_wait_useful (const int, useful_job_t=0, void *=0) |
| long double | TBCI::thread_wait_result (const int) |
| int | TBCI::threads_avail (const int=0) |
| Test availability of threads. | |
| void | TBCI::disable_threads () |
| Switch off multithreading. | |
| void | TBCI::reenable_threads () |
| Switch on multithreading again. | |
Variables | |
| int | TBCI::threads_busy = 0 |
| bool | TBCI::threads_bound = false |
| static List< cback > | TBCI::thread_cbacks |
| unsigned long | TBCI::poll_succ = 0 |
| unsigned long | TBCI::poll_fail = 0 |
| unsigned long | TBCI::polls_succ = 0 |
| unsigned long | TBCI::polls_fail = 0 |
| int | TBCI::tot_cpu_tm |
Definition in file smp.cc.
| #define _cpu_relax | ( | ) |
Definition at line 315 of file smp.cc.
Referenced by TBCI::pthr_cond_signal_mutex(), TBCI::pthr_cond_wait(), and TBCI::thread_wait_useful().
| #define ERRDECL |
Definition at line 106 of file smp.cc.
Referenced by TBCI::_thread_start_off(), TBCI::free_threads(), TBCI::pthr_cond_signal_mutex(), TBCI::pthr_cond_wait(), and TBCI::thread_wait_useful().
| #define MAX_THREADS 160 |
| #define POLL_REP 320 |
| #define POLL_REPS (POLL_REP/16) |
| #define TCHK | ( | x | ) | x |
Definition at line 105 of file smp.cc.
Referenced by TBCI::_thread_start_off(), TBCI::free_threads(), TBCI::init_threads(), TBCI::pthr_cond_signal_mutex(), TBCI::thread_wait_result(), and TBCI::thread_wait_useful().
1.5.6