"Fossies" - the Fresh Open Source Software Archive

Member "vfplot-1.0.15/src/libvfplot/pthreadextra.h" (6 Nov 2019, 1348 Bytes) of package /linux/privat/vfplot-1.0.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "pthreadextra.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2   pthreadextra.h
    3 
    4   This is taken from Aleksey Demakov [1] (with just cosmetic
    5   changes) implementing the pthread barrier functionality
    6   missing from OSX.  The licence is BSD 2-Clause "Simplified"
    7 
    8   [1] https://github.com/ademakov/DarwinPthreadBarrier
    9 */
   10 
   11 #ifndef PTHREADEXTRA_H
   12 #define PTHREADEXTRA_H
   13 
   14 #include <pthread.h>
   15 
   16 #if !defined(PTHREAD_BARRIER_SERIAL_THREAD)
   17 #define PTHREAD_BARRIER_SERIAL_THREAD (1)
   18 #endif
   19 
   20 #if !defined(PTHREAD_PROCESS_PRIVATE)
   21 #define PTHREAD_PROCESS_PRIVATE (42)
   22 #endif
   23 
   24 #if !defined(PTHREAD_PROCESS_SHARED)
   25 #define PTHREAD_PROCESS_SHARED (43)
   26 #endif
   27 
   28 typedef struct {
   29 
   30 } pthread_barrierattr_t;
   31 
   32 typedef struct {
   33   pthread_mutex_t mutex;
   34   pthread_cond_t cond;
   35   unsigned int limit;
   36   unsigned int count;
   37   unsigned int phase;
   38 } pthread_barrier_t;
   39 
   40 int pthread_barrierattr_init(pthread_barrierattr_t*);
   41 int pthread_barrierattr_destroy(pthread_barrierattr_t*);
   42 int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict,
   43                                    int *restrict);
   44 int pthread_barrierattr_setpshared(pthread_barrierattr_t*, int);
   45 int pthread_barrier_init(pthread_barrier_t *restrict,
   46                          const pthread_barrierattr_t *restrict,
   47                          unsigned int);
   48 int pthread_barrier_destroy(pthread_barrier_t*);
   49 int pthread_barrier_wait(pthread_barrier_t*);
   50 
   51 #endif