![]()  | 
  
    MAOS
    
   Multithreaded Adaptive Optics Simulator 
   | 
 
Data Structures | |
| struct | thread_t | 
Macros | |
| #define | DO_PRAGMA(A...) _Pragma(#A) | 
| #define | PRINT_MACRO(x) DO_PRAGMA(message #x " is " STR(x)) | 
| #define | STR(x) #x | 
| #define | LOCK(A) pthread_mutex_lock(&A) | 
| #define | TRYLOCK(A) pthread_mutex_trylock(&A) | 
| #define | UNLOCK(A) pthread_mutex_unlock(&A) | 
| #define | PINIT(A) pthread_mutex_init(&A,NULL) | 
| #define | PDEINIT(A) pthread_mutex_destroy(&A) | 
| #define | PNEW(A) static pthread_mutex_t A=PTHREAD_MUTEX_INITIALIZER | 
| #define | PNEW2(A) pthread_mutex_t A=PTHREAD_MUTEX_INITIALIZER | 
| #define | LOCK_FFT LOCK(mutex_fftw) | 
| #define | UNLOCK_FFT UNLOCK(mutex_fftw) | 
| #define | MEM_ORDER __ATOMIC_SEQ_CST | 
| #define | atomic_compare_exchange_n(ptr, pexpected, desired) __atomic_compare_exchange_n(ptr, pexpected, desired, 0, MEM_ORDER, MEM_ORDER) | 
| #define | atomic_compare_exchange(ptr, pexpected, pdesired) __atomic_compare_exchange(ptr, pexpected, pdesired, 0, MEM_ORDER, MEM_ORDER) | 
| #define | OMPTASK_SINGLE | 
| #define | OMP_IN_PARALLEL 0 | 
| #define | OMP_FOR(n) | 
| #define | OMP_FOR_COLLAPSE(n, nthread) | 
| #define | OMP(A) | 
| #define | OMP_TASK_FOR(ntask) | 
| #define | OMP_TASK_FOR_COLLAPSE(n, ntask) | 
| #define | OMP_CRITICAL | 
| #define | THREAD_POOL_INIT(A) ({thread_pool_init(A);info("Using thread pool with %d threads\n", A);}) | 
| #define | QUEUE(counter, fun, arg, njob, urgent) thread_pool_queue(counter, (thread_wrapfun)fun, arg, njob, urgent) | 
| Queue jobs to counter. Do not wait.  | |
| #define | QUEUE_THREAD(counter, A, urgent) thread_pool_queue(counter, NULL, A, A[0].nthread, urgent) | 
| #define | WAIT(counter, urgent) thread_pool_wait(counter, urgent) | 
| #define | CALL(fun, arg, nthread, urgent) | 
| Queue jobs to a temp counter, Then wait for it to complete.  | |
| #define | CALL_THREAD(A, urgent) | 
| #define | CALL_THREAD_ARR(A, nA, urgent) | 
Typedefs | |
| typedef void *(* | thread_fun) (void *) | 
| typedef void *(* | thread_wrapfun) (thread_t *) | 
Functions | |
| long | thread_id (void) | 
| thread_t * | thread_prep (long start, long end, long nthread, thread_wrapfun fun, void *data) | 
| prepare thread information   | |
| pthread_t | thread_new (thread_fun fun, void *arg) | 
| Create a thread and take it away.   | |
| void | thread_block_signal () | 
Functions regarding to threading.
Openmp version: 3.0 (200805): Introduced task 4.0 (201307): Introduced taskgroup. 4.5 (201511): Introduced taskloop and priority. Taskloop has implicit taskgroup.
| struct thread_t | 
prepare thread information
Break out the job to be executed by multiple threads.
| pthread_t thread_new | ( | thread_fun | fun, | 
| void * | arg | ||
| ) | 
Create a thread and take it away.
Create a new thread and forget.
| void thread_block_signal | ( | ) | 
After calling this routine, this thread will nolonger receive signals