smp.h File Reference

#include "basics.h"
#include <signal.h>
#include <cstdlib>
#include <cstdarg>
#include <sys/types.h>
#include <pthread.h>

Include dependency graph for smp.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  TBCI

Classes

struct  TBCI::thr_ctrl

Defines

#define __need_sigset_t
 Before the double inclusion guard on purpose!
#define _POSIX_C_SOURCE   200112L
#define smp_barrier()   asm ("": : :"memory")
#define MAIN_PID   (main_thread_pid)
#define THREAD_MAX_ARGS   5
#define THREAD_MAX_RES_LN   16

Typedefs

typedef void(* TBCI::thr_job_t )(struct thr_ctrl *)
typedef void *(* TBCI::useful_job_t )(void *)
typedef void TBCI::cbackfn (void *ptr, const int thr)

Functions

int TBCI::init_threads (const int thr=0)
void TBCI::free_threads ()
 Should be called on shutdown for multithreaded programs.
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.
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::thread_start (const int thr_no, thr_job_t job, const unsigned long sz,...)
 last arg must be (void*)0 !
void TBCI::thread_start_off (const int thr_no, thr_job_t job, const unsigned long offset, const unsigned long sz,...)
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)
template<typename T>
static unsigned long TBCI::slice_offset (int thr, int no_thr, unsigned long dim, T *ptr)
void TBCI::thread_reg_callback (cbackfn ctor, cbackfn dtor, void *parm)
void TBCI::thread_dereg_callback (cbackfn ctor, cbackfn dtor, void *parm)

Variables

pid_t TBCI::main_thread_pid = 0
bool TBCI::bound_main = false
int TBCI::num_threads = 0
struct thr_ctrl * TBCI::threads = 0
int TBCI::ismainthread = 1
int TBCI::thrno = 0
struct thr_ctrl * TBCI::this_thread = 0


Detailed Description

Multithreading support framework based on POSIX threads. Control via TBCI::thr_ctrl

Author:
Kurt Garloff
Date:
1998-11-02
Version:
Id
smp.h,v 1.25.2.36.2.1 2011/03/21 20:32:40 garloff Exp
License: GNU LGPL

Definition in file smp.h.


Define Documentation

#define __need_sigset_t

Before the double inclusion guard on purpose!

Definition at line 77 of file smp.h.

#define _POSIX_C_SOURCE   200112L

Definition at line 84 of file smp.h.

#define MAIN_PID   (main_thread_pid)

Definition at line 101 of file smp.h.

 
#define smp_barrier (  )     asm ("": : :"memory")

Definition at line 94 of file smp.h.

#define THREAD_MAX_ARGS   5

Definition at line 115 of file smp.h.

Referenced by TBCI::_thread_start_off().

#define THREAD_MAX_RES_LN   16

Definition at line 116 of file smp.h.

Referenced by TBCI::dot(), and TBCI::Vector< T >::operator*().


Generated on Wed Nov 20 09:28:31 2013 for TBCI Numerical high perf. C++ Library by  doxygen 1.5.6