Changeset 20be782


Ignore:
Timestamp:
Aug 8, 2022, 1:00:27 PM (8 weeks ago)
Author:
z277zhu <z277zhu@…>
Branches:
pthread-emulation
Children:
428adbc
Parents:
a7d696f
git-author:
z277zhu <z277zhu@…> (08/07/22 22:19:45)
git-committer:
z277zhu <z277zhu@…> (08/08/22 13:00:27)
Message:

add pthread

Files:
14 added
6 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    ra7d696f r20be782  
    124124        concurrency/monitor.hfa \
    125125        concurrency/mutex.hfa \
    126         concurrency/thread.hfa
     126        concurrency/thread.hfa 
    127127
    128128thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \
  • libcfa/src/bits/defs.hfa

    ra7d696f r20be782  
    2121#include <stdint.h>
    2222#include <assert.h>
    23 #include <pthread.h>
     23
    2424
    2525#define likely(x)   __builtin_expect(!!(x), 1)
     
    4444void abort( bool signalAbort, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
    4545extern "C" {
    46 #endif
    47 void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    48 int real_pthread_create(pthread_t *_thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
    49 int real_pthread_join(pthread_t _thread, void **retval);
    50 pthread_t real_pthread_self(void);
    51 int real_pthread_mutex_init(pthread_mutex_t *_mutex, const pthread_mutexattr_t *attr);
    52 int real_pthread_mutex_destroy(pthread_mutex_t *_mutex);
    53 int real_pthread_mutex_lock(pthread_mutex_t *_mutex);
    54 int real_pthread_mutex_unlock(pthread_mutex_t *_mutex);
    55 int real_pthread_mutex_trylock(pthread_mutex_t *_mutex);
    56 int real_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
    57 int real_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *_mutex);
    58 int real_pthread_cond_signal(pthread_cond_t *cond);
    59 int real_pthread_cond_broadcast(pthread_cond_t *cond);
    60 int real_pthread_cond_destroy(pthread_cond_t *cond);
    61 int real_pthread_attr_init(pthread_attr_t *attr);
    62 int real_pthread_attr_destroy(pthread_attr_t *attr);
    63 int real_pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize );
    64 int real_pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize );
    65 #ifdef __cforall
     46        #include <pthread.h>
     47        void __cabi_abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
     48        int real_pthread_create(pthread_t *_thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
     49        int real_pthread_join(pthread_t _thread, void **retval);
     50        pthread_t real_pthread_self(void);
     51        int real_pthread_attr_init(pthread_attr_t *attr);
     52        int real_pthread_attr_destroy(pthread_attr_t *attr);
     53        int real_pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize );
     54        int real_pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize );
     55        //int real_pthread_sigqueue(pthread_t _thread, int sig, const union sigval value);
     56        //int real_pthread_sigmask( int /* how */, const sigset_t * /* set */, sigset_t * /* oset */ );
    6657}
    6758#endif
  • libcfa/src/concurrency/kernel/startup.cfa

    ra7d696f r20be782  
    279279}
    280280
     281extern "C"{
     282        void pthread_delete_kernel_threads_();
     283}
     284
     285
    281286static void __kernel_shutdown(void) {
    282287        if(!cfa_main_returned) return;
     288
     289        //delete kernel threads for pthread_concurrency
     290        pthread_delete_kernel_threads_();
     291
    283292        /* paranoid */ verify( __preemption_enabled() );
    284293        disable_interrupts();
  • libcfa/src/concurrency/pthread.cfa

    ra7d696f r20be782  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2019 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// pthread.cfa --
     8//
     9// Author           : Zhenyan Zhu
     10// Created On       : Sat Aug 6 16:29:18 2022
     11// Last Modified By :
     12// Last Modified On :
     13// Update Count     :
     14//
    115
    216#define __cforall_thread__
    317#define _GNU_SOURCE
    418
     19#include <pthread.h>
     20#include <errno.h>
    521#include "locks.hfa"
    6 #include <fstream.hfa>
    7 #include <pthread.h>
    8 #include <clib/cfathread.h>
    9 #include <invoke.h>
    10 #include <bits/stack.hfa>
    11 
    12 #ifdef PNOOUTPUT
    13  #define PRINT( stmt )
    14 #else
    15  #define PRINT( stmt ) stmt
    16 #endif // NOOUTPUT
     22#include "bits/stack.hfa"
     23
    1724
    1825#pragma GCC diagnostic push
    1926#pragma GCC diagnostic ignored "-Wnonnull-compare"
    2027
    21 /* pthread key, pthread once*/
     28/* pthread key, pthread once inner routine mutual exclusion */
    2229static simple_owner_lock once_lock,key_lock,magic_mutex_check, concurrency_lock;
     30
    2331//######################### Local Storage Helpers #########################
    2432
     
    3240
    3341
    34 Pthread_values *& Back( Pthread_values * n ) {
     42static Pthread_values *& Back( Pthread_values * n ) {
    3543    return (Pthread_values *)Back( (Seqable *)n );
    3644}
    37 Pthread_values *& Next( Pthread_values * n ) {
     45static Pthread_values *& Next( Pthread_values * n ) {
    3846    return (Pthread_values *)Next( (Colable *)n );
    3947}
     
    5462static Pthread_keys cfa_pthread_keys_storage[PTHREAD_KEYS_MAX] __attribute__((aligned (16)));
    5563
    56 void init_pthread_storage(){
     64static void init_pthread_storage(){
    5765    for (int i = 0; i < PTHREAD_KEYS_MAX; i++){
    5866        cfa_pthread_keys_storage[i]{};
     
    8997/* condvar helper routines */
    9098static void init(pthread_cond_t* pcond){
     99    static_assert(sizeof(pthread_cond_t) >= sizeof(cfa2pthr_cond_var_t),"sizeof(pthread_t) < sizeof(cfa2pthr_cond_var_t)");
    91100    cfa2pthr_cond_var_t* _cond = (cfa2pthr_cond_var_t*)pcond;
    92101    ?{}(*_cond);
     
    94103
    95104static cfa2pthr_cond_var_t* get(pthread_cond_t* pcond){
     105    static_assert(sizeof(pthread_cond_t) >= sizeof(cfa2pthr_cond_var_t),"sizeof(pthread_t) < sizeof(cfa2pthr_cond_var_t)");
    96106    return (cfa2pthr_cond_var_t*)pcond;
    97107}
    98108
    99109static void destroy(pthread_cond_t* cond){
     110    static_assert(sizeof(pthread_cond_t) >= sizeof(cfa2pthr_cond_var_t),"sizeof(pthread_t) < sizeof(cfa2pthr_cond_var_t)");
    100111    ^?{}(*get(cond));
    101112}
     
    110121        // SKULLDUGGERY: not a portable way to access the kind field, /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
    111122        int _lock_val = ((pthread_mutex_t *)mutex_)->__data.__lock;
    112     //sout | _lock_val ;
    113         // kind is a small pthread enumerated type. If it greater than 32, it is a value in an uOwnerlock field.
     123        // if pthread_mutex_t is initialized by PTHREAD_MUTEX_INITIALIZER, _lock_val should be 0
    114124        if ( _lock_val == 0 ) {                 // static initialized ?
    115125            lock(magic_mutex_check);    // race
     
    124134
    125135static void init(pthread_mutex_t* plock){
     136    static_assert(sizeof(pthread_mutex_t) >= sizeof(simple_owner_lock),"sizeof(pthread_mutex_t) < sizeof(simple_owner_lock)");
    126137    simple_owner_lock* _lock = (simple_owner_lock*)plock;
    127138    ?{}(*_lock);
     
    129140
    130141static simple_owner_lock* get(pthread_mutex_t* plock){
     142    static_assert(sizeof(pthread_mutex_t) >= sizeof(simple_owner_lock),"sizeof(pthread_mutex_t) < sizeof(simple_owner_lock)");
    131143    return (simple_owner_lock*)plock;
    132144}
    133145
    134146static void destroy(pthread_mutex_t* plock){
     147    static_assert(sizeof(pthread_mutex_t) >= sizeof(simple_owner_lock),"sizeof(pthread_mutex_t) < sizeof(simple_owner_lock)");
    135148    ^?{}(*get(plock));
    136149}
     
    159172
    160173/*
    161 cfaPthread_attr_t default_attrs = {
     174static const cfaPthread_attr_t default_attrs = {
    162175    PTHREAD_SCOPE_SYSTEM,
    163176    PTHREAD_CREATE_JOINABLE,
     
    171184
    172185
     186
    173187static cfaPthread_attr_t* get(const pthread_attr_t* attr){
     188    static_assert(sizeof(pthread_attr_t) >= sizeof(cfaPthread_attr_t),"sizeof(pthread_attr_t) < sizeof(cfaPthread_attr_t)");
    174189    return (cfaPthread_attr_t*)attr;
    175190}
     
    178193//######################### Threads Helper #########################
    179194
     195// exception for cancel_stack in pthread_exit
    180196exception pthread_exit_exp {};
    181197static vtable(pthread_exit_exp) exp;
     
    201217// generate pthread_t by cfaPthread ptr
    202218static pthread_t create( cfaPthread *p ) {
    203             return (pthread_t)p;
     219    static_assert(sizeof(pthread_t) >= sizeof(cfaPthread*),"sizeof(pthread_t) < sizeof(cfaPthread*)");
     220        return (pthread_t)p;
    204221}
    205222
    206223static cfaPthread *lookup( pthread_t p ){
     224    static_assert(sizeof(pthread_t) >= sizeof(cfaPthread*),"sizeof(pthread_t) < sizeof(cfaPthread*)");
    207225    return (cfaPthread*)p;
    208226}
    209227
    210 void pthread_deletespecific_( Pthread_values* values )  { // see uMachContext::invokeTask
     228static void pthread_deletespecific_( Pthread_values* values )  { // see uMachContext::invokeTask
    211229    Pthread_values* value;
    212230    Pthread_keys* key;
     
    240258}
    241259
    242 void ^?{}(cfaPthread & mutex t){
    243     //^?{}((thread$&)t);
     260static void ^?{}(cfaPthread & mutex t){
     261    // delete pthread local storage
    244262    Pthread_values* values = t.pthreadData;
    245263    pthread_deletespecific_(values);
    246     PRINT(sout | "thread exited" | t.pthreadId;)
    247264}
    248265
     
    270287    //######################### Pthread Attrs #########################
    271288
    272     int pthread_attr_init(pthread_attr_t *attr){
     289    int pthread_attr_init(pthread_attr_t *attr) libcfa_public __THROW {
    273290        cfaPthread_attr_t* _attr = get(attr);
    274291        ?{}(*_attr);
     
    276293        return 0;
    277294    }
    278     int pthread_attr_destroy(pthread_attr_t *attr){
     295    int pthread_attr_destroy(pthread_attr_t *attr) libcfa_public __THROW {
    279296        ^?{}(*get(attr));
    280297        return 0;
    281298    }
    282299   
    283     int pthread_attr_setscope( pthread_attr_t *attr, int contentionscope ) {
     300    int pthread_attr_setscope( pthread_attr_t *attr, int contentionscope ) libcfa_public __THROW {
    284301        get( attr )->contentionscope = contentionscope;
    285302        return 0;
    286303    } // pthread_attr_setscope
    287304
    288     int pthread_attr_getscope( const pthread_attr_t *attr, int *contentionscope ) {
     305    int pthread_attr_getscope( const pthread_attr_t *attr, int *contentionscope ) libcfa_public __THROW {
    289306        *contentionscope = get( attr )->contentionscope;
    290307        return 0;
    291308    } // pthread_attr_getscope
    292309
    293     int pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) {
     310    int pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate ) libcfa_public __THROW {
    294311        get( attr )->detachstate = detachstate;
    295312        return 0;
    296313    } // pthread_attr_setdetachstate
    297314
    298     int pthread_attr_getdetachstate( const pthread_attr_t *attr, int *detachstate ) {
     315    int pthread_attr_getdetachstate( const pthread_attr_t *attr, int *detachstate ) libcfa_public __THROW {
    299316        *detachstate = get( attr )->detachstate;
    300317        return 0;
    301318    } // pthread_attr_getdetachstate
    302319
    303     int pthread_attr_setstacksize( pthread_attr_t *attr, size_t stacksize ) {
     320    int pthread_attr_setstacksize( pthread_attr_t *attr, size_t stacksize ) libcfa_public __THROW {
    304321        get( attr )->stacksize = stacksize;
    305322        return 0;
    306323    } // pthread_attr_setstacksize
    307324
    308     int pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize ) {
     325    int pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize ) libcfa_public __THROW {
    309326        *stacksize = get( attr )->stacksize;
    310327        return 0;
    311328    } // pthread_attr_getstacksize
    312329
    313     int pthread_attr_getguardsize( const pthread_attr_t * /* attr */, size_t * /* guardsize */ ) {
     330    int pthread_attr_getguardsize( const pthread_attr_t * /* attr */, size_t * /* guardsize */ ) libcfa_public __THROW {
    314331            return 0;
    315332    } // pthread_attr_getguardsize
    316333
    317     int pthread_attr_setguardsize( pthread_attr_t * /* attr */, size_t /* guardsize */ ) {
     334    int pthread_attr_setguardsize( pthread_attr_t * /* attr */, size_t /* guardsize */ ) libcfa_public __THROW {
    318335            return 0;
    319336    } // pthread_attr_setguardsize
    320337
    321     int pthread_attr_setstackaddr( pthread_attr_t *attr, void *stackaddr ) {
     338    int pthread_attr_setstackaddr( pthread_attr_t *attr, void *stackaddr ) libcfa_public __THROW {
    322339        get( attr )->stackaddr = stackaddr;
    323340        return 0;
    324341    } // pthread_attr_setstackaddr
    325342
    326     int pthread_attr_getstackaddr( const pthread_attr_t *attr, void **stackaddr ) {
     343    int pthread_attr_getstackaddr( const pthread_attr_t *attr, void **stackaddr ) libcfa_public __THROW {
    327344        *stackaddr = get( attr )->stackaddr;
    328345        return 0;
    329346    } // pthread_attr_getstackaddr
    330347
    331     int pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize ) {
     348    int pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize ) libcfa_public __THROW {
    332349        get( attr )->stackaddr = stackaddr;
    333350        get( attr )->stacksize = stacksize;
     
    335352    } // pthread_attr_setstack
    336353
    337     int pthread_attr_getstack( const pthread_attr_t *attr, void **stackaddr, size_t *stacksize ) {
     354    int pthread_attr_getstack( const pthread_attr_t *attr, void **stackaddr, size_t *stacksize ) libcfa_public __THROW {
    338355        *stackaddr = get( attr )->stackaddr;
    339356        *stacksize = get( attr )->stacksize;
     
    344361    // already running thread threadID. It shall be called on unitialized attr
    345362    // and destroyed with pthread_attr_destroy when no longer needed.
    346     int pthread_getattr_np( pthread_t threadID, pthread_attr_t *attr ) __THROW { // GNU extension
     363    int pthread_getattr_np( pthread_t threadID, pthread_attr_t *attr ) libcfa_public __THROW { // GNU extension
    347364        // race condition during copy
    348365        cfaPthread_attr_t* _attr = get(attr);
     
    358375    //######################### Threads #########################
    359376
    360     int pthread_create(pthread_t * _thread, const pthread_attr_t * attr, void *(*start_routine)(void *), void * arg){
     377    int pthread_create(pthread_t * _thread, const pthread_attr_t * attr, void *(*start_routine)(void *), void * arg) libcfa_public __THROW {
    361378        cfaPthread *t = alloc();
    362379        (*t){_thread, attr, start_routine, arg};
     
    367384
    368385
    369     int pthread_join(pthread_t _thread, void **value_ptr){
     386    int pthread_join(pthread_t _thread, void **value_ptr) libcfa_public __THROW {
    370387        if (_thread == NULL) return EINVAL;   // if thread is invalid
    371388        if (_thread == pthread_self()) return EDEADLK;
     
    379396    }   //pthread_join_
    380397
    381     int pthread_tryjoin_np(pthread_t _thread, void **value_ptr){
     398    int pthread_tryjoin_np(pthread_t _thread, void **value_ptr) libcfa_public __THROW {
    382399        if (_thread == NULL) return EINVAL;  // if thread is invalid
    383400        if (_thread == pthread_self()) return EDEADLK;
     
    390407    }   //pthread_join_
    391408
    392     pthread_t pthread_self(void){
     409    pthread_t pthread_self(void) libcfa_public __THROW {
    393410        return (pthread_t)((char*)active_thread()-(sizeof(cfaPthread)-sizeof(thread$)));
    394411    }   //pthread_self_
    395412
    396     void pthread_exit(void * status){
     413    void pthread_exit(void * status) libcfa_public __THROW {
    397414        pthread_t pid = pthread_self();
    398415        cfaPthread* _thread = (cfaPthread*)pid;
     
    402419    }   //pthread_exit_
    403420
     421    int pthread_yield( void ) __THROW {                 // GNU extension
     422        yield();
     423        return 0;
     424    }
    404425
    405426
    406427    //######################### Mutex #########################
    407428
    408     int pthread_mutex_init(pthread_mutex_t *_mutex, const pthread_mutexattr_t *attr){
     429    int pthread_mutex_init(pthread_mutex_t *_mutex, const pthread_mutexattr_t *attr) libcfa_public __THROW {
    409430        if (_mutex == NULL) return EINVAL;
    410431
     
    414435
    415436
    416     int pthread_mutex_destroy(pthread_mutex_t *_mutex){
     437    int pthread_mutex_destroy(pthread_mutex_t *_mutex) libcfa_public __THROW{
    417438        if (_mutex == NULL){
    418439             return EINVAL;
     
    426447    }   //pthread_mutex_destroy_
    427448
    428     int pthread_mutex_lock(pthread_mutex_t *_mutex){
     449    int pthread_mutex_lock(pthread_mutex_t *_mutex) libcfa_public __THROW{
    429450        if (_mutex == NULL) {
    430451            return EINVAL;
     
    436457    }   //pthread_mutex_lock_
    437458
    438     int pthread_mutex_unlock(pthread_mutex_t *_mutex){
     459    int pthread_mutex_unlock(pthread_mutex_t *_mutex) libcfa_public __THROW{
    439460        if (_mutex == NULL) {
    440461            return EINVAL;
     
    448469    }   //pthread_mutex_unlock_
    449470
    450     int pthread_mutex_trylock(pthread_mutex_t *_mutex){
     471    int pthread_mutex_trylock(pthread_mutex_t *_mutex) libcfa_public __THROW{
    451472        if (_mutex == NULL) {
    452473            return EINVAL;
     
    463484
    464485    /* conditional variable routines */
    465     int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr){
     486    int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) libcfa_public __THROW {
    466487        if (cond == NULL) return EINVAL;
    467488        init(cond);
    468489        return 0;
    469     }
    470     int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *_mutex){
     490    }  //pthread_cond_init
     491
     492    int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *_mutex) libcfa_public __THROW {
    471493        if (cond == NULL || _mutex == NULL){
    472494            return EINVAL;
     
    474496        wait(*get(cond), *get(_mutex));
    475497        return 0;
    476     }
    477 
    478     int pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * _mutex, const struct timespec * abstime){
     498    } // pthread_cond_wait
     499
     500    int pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * _mutex, const struct timespec * abstime) libcfa_public __THROW {
    479501        if (cond == NULL || _mutex == NULL){
    480502            return EINVAL;
     
    482504        wait(*get(cond), *get(_mutex), *abstime);
    483505        return 0;
    484     }
    485 
    486 
    487     int pthread_cond_signal(pthread_cond_t *cond){
     506    } // pthread_cond_timedwait
     507
     508    int pthread_cond_signal(pthread_cond_t *cond) libcfa_public __THROW {
    488509        if (cond == NULL){
    489510            return EINVAL;
    490511        }   // invalid cond
    491512        return notify_one(*get(cond));
    492     }
    493     int pthread_cond_broadcast(pthread_cond_t *cond){
     513    } // pthread_cond_signal
     514
     515    int pthread_cond_broadcast(pthread_cond_t *cond) libcfa_public __THROW {
    494516        if (cond == NULL){
    495517            return EINVAL;
    496518        }   // invalid cond
    497519        return notify_all(*get(cond));
    498     }
    499     int pthread_cond_destroy(pthread_cond_t *cond){
     520    } // pthread_cond_broadcast
     521
     522    int pthread_cond_destroy(pthread_cond_t *cond) libcfa_public __THROW {
    500523        if (cond == NULL){
    501524            return EINVAL;
     
    503526        destroy(cond);
    504527        return 0;
    505     }
     528    } // pthread_cond_destroy
    506529
    507530
     
    509532    //######################### Local storage #########################
    510533
    511     int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)){
     534    int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) libcfa_public __THROW {
     535        static_assert(sizeof(pthread_once_t) >= sizeof(int),"sizeof(pthread_once_t) < sizeof(int)");
     536        if (once_control == NULL){
     537            return EINVAL;
     538        }
     539        if (init_routine == NULL){
     540            return EINVAL;
     541        }
    512542        lock(once_lock);
    513543        if ( *((int *)once_control) == 0 ) {
     
    517547        unlock(once_lock);
    518548        return 0;
    519     }
    520 
    521     int pthread_key_create( pthread_key_t *key, void (*destructor)( void * ) ){
     549    } // pthread_once
     550
     551    int pthread_key_create( pthread_key_t *key, void (*destructor)( void * ) ) libcfa_public __THROW {
    522552        lock(key_lock);
    523553        for ( int i = 0; i < PTHREAD_KEYS_MAX; i += 1 ) {
     
    534564    }   // pthread_key_create
    535565
    536     int pthread_key_delete( pthread_key_t key ){
     566    int pthread_key_delete( pthread_key_t key ) libcfa_public __THROW {
    537567        lock(key_lock);
    538568        if ( key >= PTHREAD_KEYS_MAX || ! cfa_pthread_keys[key].in_use ) {
     
    554584    }   // pthread_key_delete
    555585
    556     int pthread_setspecific( pthread_key_t key, const void *value ){
     586    int pthread_setspecific( pthread_key_t key, const void *value ) libcfa_public __THROW {
    557587        // get current thread
    558588        cfaPthread* t = lookup(pthread_self());
     
    585615    } //pthread_setspecific
    586616
    587     void* pthread_getspecific(pthread_key_t key){
     617    void* pthread_getspecific(pthread_key_t key) libcfa_public __THROW {
    588618        if (key >= PTHREAD_KEYS_MAX || ! cfa_pthread_keys[key].in_use) return NULL;
    589619
     
    604634
    605635    //######################### Parallelism #########################
    606     void pthread_delete_kernel_threads_() {     // see uMain::~uMain
     636    void pthread_delete_kernel_threads_() libcfa_public __THROW {       // see uMain::~uMain
    607637        Pthread_kernel_threads& p;
    608638        for ( StackIter(Pthread_kernel_threads) iter = {cfa_pthreads_kernel_threads}; iter | p; ) {
     
    611641    } // pthread_delete_kernel_threads_
    612642
    613     int pthread_getconcurrency( void ) {        // XOPEN extension
     643    int pthread_getconcurrency( void ) libcfa_public __THROW {  // XOPEN extension
    614644            return cfa_pthreads_kernel_threads_zero ? 0 : cfa_pthreads_no_kernel_threads;
    615645    } // pthread_getconcurrency
    616646
    617     int pthread_setconcurrency( int new_level ) { // XOPEN extension
     647    int pthread_setconcurrency( int new_level ) libcfa_public __THROW { // XOPEN extension
    618648      if ( new_level < 0 ) return EINVAL;
    619649      if ( new_level == 0 ) {
     
    633663    } // pthread_setconcurrency
    634664
     665    //######################### Signal #########################
     666
     667
     668    // int pthread_sigmask( int /* how */, const sigset_t * /* set */, sigset_t * /* oset */ ) libcfa_public __THROW {
     669        //     return 0;
     670    // } // pthread_sigmask
     671
     672    int pthread_kill( pthread_t _thread __attribute__(( unused )), int sig ) libcfa_public __THROW {
     673        if ( sig == 0 ) {
     674            return 0;
     675        } else {
     676            abort( "pthread_kill : not implemented" );
     677        } // if
     678        return 0;
     679    } // pthread_kill
     680
     681    // int pthread_sigqueue(pthread_t , int sig, const union sigval) libcfa_public __THROW {
     682    //     return 0;
     683    // } // pthread_sigqueue
     684
    635685    //######################### Scheduling #########################
    636 
    637 
    638     int pthread_setschedparam( pthread_t /* thread */, int /* policy */, const struct sched_param * /* param */ ) __THROW {
    639         abort( "pthread_setschedparam : not implemented" );
    640         return 0;
     686    int pthread_detach( pthread_t threadID ) __THROW {
     687        abort( "pthread_detach" );
     688        return 0;
     689    } // pthread_detach
     690
     691    int pthread_setschedparam( pthread_t /* thread */, int /* policy */, const struct sched_param * /* param */ ) libcfa_public __THROW {
     692        abort( "pthread_setschedparam : not implemented" );
     693        return 0;
    641694    } // pthread_setschedparam
    642695
    643     int pthread_getschedparam( pthread_t /* thread */, int */* policy */, struct sched_param * /* param */ ) __THROW {
    644         abort( "pthread_getschedparam : not implemented" );
    645         return 0;
     696    int pthread_getschedparam( pthread_t /* thread */, int */* policy */, struct sched_param * /* param */ ) libcfa_public __THROW {
     697        abort( "pthread_getschedparam : not implemented" );
     698        return 0;
    646699    } // pthread_getschedparam
    647700
    648701     //######################### Mutex Attr #########################
    649702
    650     int pthread_mutexattr_init( pthread_mutexattr_t * /* attr */ ) __THROW {
    651         return 0;
     703    int pthread_mutexattr_init( pthread_mutexattr_t * /* attr */ ) libcfa_public __THROW {
     704            return 0;
    652705    } // pthread_mutexattr_init
    653706
    654     int pthread_mutexattr_destroy( pthread_mutexattr_t * /* attr */ ) __THROW {
     707    int pthread_mutexattr_destroy( pthread_mutexattr_t * /* attr */ ) libcfa_public __THROW {
    655708        return 0;
    656709    } // pthread_mutexattr_destroy
    657710
    658     int pthread_mutexattr_setpshared( pthread_mutexattr_t * /* attr */, int /* pshared */ ) __THROW {
     711    int pthread_mutexattr_setpshared( pthread_mutexattr_t * /* attr */, int /* pshared */ ) libcfa_public __THROW {
    659712        return 0;
    660713    } // pthread_mutexattr_setpshared
    661714
    662     int pthread_mutexattr_getpshared( const pthread_mutexattr_t * /* attr */, int * /* pshared */ ) __THROW {
     715    int pthread_mutexattr_getpshared( const pthread_mutexattr_t * /* attr */, int * /* pshared */ ) libcfa_public __THROW {
    663716        return 0;
    664717    } // pthread_mutexattr_getpshared
    665718
    666     int pthread_mutexattr_setprotocol( pthread_mutexattr_t * /* attr */, int /* protocol */ ) __THROW {
     719    int pthread_mutexattr_setprotocol( pthread_mutexattr_t * /* attr */, int /* protocol */ ) libcfa_public __THROW {
    667720        return 0;
    668721    } // pthread_mutexattr_setprotocol
    669722
    670     int pthread_mutexattr_getprotocol( const pthread_mutexattr_t * /* attr */, int * /* protocol */ ) __THROW {
     723    int pthread_mutexattr_getprotocol( const pthread_mutexattr_t * /* attr */, int * /* protocol */ ) libcfa_public __THROW {
    671724        return 0;
    672725    } // pthread_mutexattr_getprotocol
    673726
    674     int pthread_mutexattr_setprioceiling( pthread_mutexattr_t * /* attr */, int /* prioceiling */ ) __THROW {
     727    int pthread_mutexattr_setprioceiling( pthread_mutexattr_t * /* attr */, int /* prioceiling */ ) libcfa_public __THROW {
    675728        return 0;
    676729    } // pthread_mutexattr_setprioceiling
    677730
    678     int pthread_mutexattr_getprioceiling( const pthread_mutexattr_t * /* attr */, int * /* ceiling */ ) __THROW {
     731    int pthread_mutexattr_getprioceiling( const pthread_mutexattr_t * /* attr */, int * /* ceiling */ ) libcfa_public __THROW {
    679732        return 0;
    680733    } // pthread_mutexattr_getprioceiling
    681734
    682     int pthread_mutex_setprioceiling( pthread_mutex_t * /* mutex */, int /* prioceiling */, int * /* old_ceiling */ ) __THROW {
     735    int pthread_mutex_setprioceiling( pthread_mutex_t * /* mutex */, int /* prioceiling */, int * /* old_ceiling */ ) libcfa_public __THROW {
    683736        return 0;
    684737    } // pthread_mutex_setprioceiling
    685738
    686     int pthread_mutex_getprioceiling( const pthread_mutex_t * /* mutex */, int * /* ceiling */ ) __THROW {
     739    int pthread_mutex_getprioceiling( const pthread_mutex_t * /* mutex */, int * /* ceiling */ ) libcfa_public __THROW {
    687740        return 0;
    688741    } // pthread_mutex_getprioceiling
    689742
    690     int pthread_mutexattr_gettype( __const pthread_mutexattr_t * __restrict /* __attr */, int * __restrict /* __kind */ ) __THROW {
     743    int pthread_mutexattr_gettype( __const pthread_mutexattr_t * __restrict /* __attr */, int * __restrict /* __kind */ ) libcfa_public __THROW {
    691744        return 0;
    692745    } // pthread_mutexattr_gettype
    693746
    694     int pthread_mutexattr_settype( pthread_mutexattr_t * /* __attr */, int /* __kind */ ) __THROW {
     747    int pthread_mutexattr_settype( pthread_mutexattr_t * /* __attr */, int /* __kind */ ) libcfa_public __THROW {
    695748        return 0;
    696749    } // pthread_mutexattr_settype
     
    698751    //######################### Mutex #########################
    699752
    700     int pthread_mutex_timedlock( pthread_mutex_t *__restrict /* __mutex */, __const struct timespec *__restrict /* __abstime */ ) __THROW {
     753    int pthread_mutex_timedlock( pthread_mutex_t *__restrict /* __mutex */, __const struct timespec *__restrict /* __abstime */ ) libcfa_public __THROW {
    701754            abort( "pthread_mutex_timedlock" );
    702755    } // pthread_mutex_timedlock
     
    704757    //######################### Condition #########################
    705758
    706     int pthread_condattr_getclock( __const pthread_condattr_t * __restrict /* __attr */, __clockid_t *__restrict /* __clock_id */ ) __THROW {
     759    int pthread_condattr_getclock( __const pthread_condattr_t * __restrict /* __attr */, __clockid_t *__restrict /* __clock_id */ ) libcfa_public __THROW {
    707760            abort( "pthread_condattr_getclock" );
    708761    } // pthread_condattr_getclock
    709762
    710     int pthread_condattr_setclock( pthread_condattr_t * /* __attr */, __clockid_t /* __clock_id */ ) __THROW {
     763    int pthread_condattr_setclock( pthread_condattr_t * /* __attr */, __clockid_t /* __clock_id */ ) libcfa_public __THROW {
    711764            abort( "pthread_condattr_setclock" );
    712765    } // pthread_condattr_setclock
     
    714767    //######################### Spinlock #########################
    715768
    716     int pthread_spin_init( pthread_spinlock_t * /* __lock */, int /*__pshared */ ) __THROW {
     769    int pthread_spin_init( pthread_spinlock_t * /* __lock */, int /*__pshared */ ) libcfa_public __THROW {
    717770            abort( "pthread_spin_init" );
    718771    } // pthread_spin_init
    719772
    720     int pthread_spin_destroy( pthread_spinlock_t * /* __lock */ ) __THROW {
     773    int pthread_spin_destroy( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW {
    721774            abort( "pthread_spin_destroy" );
    722775    } // pthread_spin_destroy
    723776
    724     int pthread_spin_lock( pthread_spinlock_t * /* __lock */ ) __THROW {
     777    int pthread_spin_lock( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW {
    725778            abort( "pthread_spin_lock" );
    726779    } // pthread_spin_lock
    727780
    728     int pthread_spin_trylock( pthread_spinlock_t * /* __lock */ ) __THROW {
     781    int pthread_spin_trylock( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW {
    729782            abort( "pthread_spin_trylock" );
    730783    } // pthread_spin_trylock
    731784
    732     int pthread_spin_unlock( pthread_spinlock_t * /* __lock */ ) __THROW {
     785    int pthread_spin_unlock( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW {
    733786            abort( "pthread_spin_unlock" );
    734787    } // pthread_spin_unlock
     
    736789    //######################### Barrier #########################
    737790
    738     int pthread_barrier_init( pthread_barrier_t *__restrict /* __barrier */, __const pthread_barrierattr_t *__restrict /* __attr */, unsigned int /* __count */ ) __THROW {
     791    int pthread_barrier_init( pthread_barrier_t *__restrict /* __barrier */, __const pthread_barrierattr_t *__restrict /* __attr */, unsigned int /* __count */ ) libcfa_public __THROW {
    739792            abort( "pthread_barrier_init" );
    740793    } // pthread_barrier_init
    741794
    742     int pthread_barrier_destroy( pthread_barrier_t * /* __barrier */ ) __THROW {
     795    int pthread_barrier_destroy( pthread_barrier_t * /* __barrier */ ) libcfa_public  __THROW {
    743796            abort( "pthread_barrier_destroy" );
    744797    } // pthread_barrier_destroy
    745798
    746     int pthread_barrier_wait( pthread_barrier_t * /* __barrier */ ) __THROW {
     799    int pthread_barrier_wait( pthread_barrier_t * /* __barrier */ ) libcfa_public __THROW {
    747800            abort( "pthread_barrier_wait" );
    748801    } // pthread_barrier_wait
    749802
    750     int pthread_barrierattr_init( pthread_barrierattr_t * /* __attr */ ) __THROW {
     803    int pthread_barrierattr_init( pthread_barrierattr_t * /* __attr */ ) libcfa_public __THROW {
    751804            abort( "pthread_barrierattr_init" );
    752805    } // pthread_barrierattr_init
    753806
    754     int pthread_barrierattr_destroy( pthread_barrierattr_t * /* __attr */ ) __THROW {
     807    int pthread_barrierattr_destroy( pthread_barrierattr_t * /* __attr */ ) libcfa_public __THROW {
    755808            abort( "pthread_barrierattr_destroy" );
    756809    } // pthread_barrierattr_destroy
    757810
    758     int pthread_barrierattr_getpshared( __const pthread_barrierattr_t * __restrict /* __attr */, int *__restrict /* __pshared */ ) __THROW {
     811    int pthread_barrierattr_getpshared( __const pthread_barrierattr_t * __restrict /* __attr */, int *__restrict /* __pshared */ ) libcfa_public __THROW {
    759812            abort( "pthread_barrierattr_getpshared" );
    760813    } // pthread_barrierattr_getpshared
    761814
    762     int pthread_barrierattr_setpshared( pthread_barrierattr_t * /* __attr */, int /* __pshared */ ) __THROW {
     815    int pthread_barrierattr_setpshared( pthread_barrierattr_t * /* __attr */, int /* __pshared */ ) libcfa_public __THROW {
    763816            abort( "pthread_barrierattr_setpshared" );
    764817    } // pthread_barrierattr_setpshared
     
    766819    //######################### Clock #########################
    767820
    768     int pthread_getcpuclockid( pthread_t /* __thread_id */, __clockid_t * /* __clock_id */ ) __THROW {
     821    int pthread_getcpuclockid( pthread_t /* __thread_id */, __clockid_t * /* __clock_id */ ) libcfa_public __THROW {
    769822            abort( "pthread_getcpuclockid" );
    770823    } // pthread_getcpuclockid
     
    776829    //######################### Read/Write #########################
    777830
    778     int pthread_rwlock_init( pthread_rwlock_t *__restrict /* __rwlock */, __const pthread_rwlockattr_t *__restrict /* __attr */ ) __THROW {
     831    int pthread_rwlock_init( pthread_rwlock_t *__restrict /* __rwlock */, __const pthread_rwlockattr_t *__restrict /* __attr */ ) libcfa_public __THROW {
    779832            abort( "pthread_rwlock_init" );
    780833    } // pthread_rwlock_init
    781834
    782     int pthread_rwlock_destroy( pthread_rwlock_t * /* __rwlock */ ) __THROW {
     835    int pthread_rwlock_destroy( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW {
    783836            abort( "pthread_rwlock_destroy" );
    784837    } // pthread_rwlock_destroy
    785838
    786     int pthread_rwlock_rdlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {
     839    int pthread_rwlock_rdlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW {
    787840            abort( "pthread_rwlock_rdlock" );
    788841    } // pthread_rwlock_rdlock
    789842
    790     int pthread_rwlock_tryrdlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {
     843    int pthread_rwlock_tryrdlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW {
    791844            abort( "pthread_rwlock_tryrdlock" );
    792845    } // pthread_rwlock_tryrdlock
    793846
    794     int pthread_rwlock_wrlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {
     847    int pthread_rwlock_wrlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW {
    795848            abort( "pthread_rwlock_wrlock" );
    796849    } // pthread_rwlock_wrlock
    797850
    798     int pthread_rwlock_trywrlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {
     851    int pthread_rwlock_trywrlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW {
    799852            abort( "pthread_rwlock_trywrlock" );
    800853    } // pthread_rwlock_trywrlock
    801854
    802     int pthread_rwlock_unlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {
     855    int pthread_rwlock_unlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW {
    803856            abort( "pthread_rwlock_unlock" );
    804857    } // pthread_rwlock_unlock
    805858
    806     int pthread_rwlockattr_init( pthread_rwlockattr_t * /* __attr */ ) __THROW {
     859    int pthread_rwlockattr_init( pthread_rwlockattr_t * /* __attr */ ) libcfa_public __THROW {
    807860            abort( "pthread_rwlockattr_init" );
    808861    } // pthread_rwlockattr_init
    809862
    810     int pthread_rwlockattr_destroy( pthread_rwlockattr_t * /*__attr */ ) __THROW {
     863    int pthread_rwlockattr_destroy( pthread_rwlockattr_t * /*__attr */ ) libcfa_public __THROW {
    811864            abort( "pthread_rwlockattr_destroy" );
    812865    } // pthread_rwlockattr_destroy
    813866
    814     int pthread_rwlockattr_getpshared( __const pthread_rwlockattr_t * __restrict /* __attr */, int *__restrict /* __pshared */ ) __THROW {
     867    int pthread_rwlockattr_getpshared( __const pthread_rwlockattr_t * __restrict /* __attr */, int *__restrict /* __pshared */ ) libcfa_public __THROW {
    815868            abort( "pthread_rwlockattr_getpshared" );
    816869    } // pthread_rwlockattr_getpshared
    817870
    818     int pthread_rwlockattr_setpshared( pthread_rwlockattr_t * /* __attr */, int /* __pshared */ ) __THROW {
     871    int pthread_rwlockattr_setpshared( pthread_rwlockattr_t * /* __attr */, int /* __pshared */ ) libcfa_public __THROW {
    819872            abort( "pthread_rwlockattr_setpshared" );
    820873    } // pthread_rwlockattr_setpshared
    821874
    822     int pthread_rwlockattr_getkind_np( __const pthread_rwlockattr_t * /* __attr */, int * /* __pref */ ) __THROW {
     875    int pthread_rwlockattr_getkind_np( __const pthread_rwlockattr_t * /* __attr */, int * /* __pref */ ) libcfa_public __THROW {
    823876            abort( "pthread_rwlockattr_getkind_np" );
    824877    } // pthread_rwlockattr_getkind_np
    825878
    826     int pthread_rwlockattr_setkind_np( pthread_rwlockattr_t * /* __attr */, int /* __pref */ ) __THROW {
     879    int pthread_rwlockattr_setkind_np( pthread_rwlockattr_t * /* __attr */, int /* __pref */ ) libcfa_public __THROW {
    827880            abort( "pthread_rwlockattr_setkind_np" );
    828881    } // pthread_rwlockattr_setkind_np
     
    830883// UNIX98 + XOPEN
    831884
    832     int pthread_rwlock_timedrdlock( pthread_rwlock_t *__restrict  /* __rwlock */, __const struct timespec *__restrict /* __abstime */ ) __THROW {
     885    int pthread_rwlock_timedrdlock( pthread_rwlock_t *__restrict  /* __rwlock */, __const struct timespec *__restrict /* __abstime */ ) libcfa_public __THROW {
    833886            abort( "pthread_rwlock_timedrdlock" );
    834887    } // pthread_rwlock_timedrdlock
    835888
    836     int pthread_rwlock_timedwrlock( pthread_rwlock_t *__restrict  /* __rwlock */, __const struct timespec *__restrict /* __abstime */ ) __THROW {
     889    int pthread_rwlock_timedwrlock( pthread_rwlock_t *__restrict  /* __rwlock */, __const struct timespec *__restrict /* __abstime */ ) libcfa_public __THROW {
    837890            abort( "pthread_rwlock_timedwrlock" );
    838891    } // pthread_rwlock_timedwrlock
     
    842895    //######################### Parallelism #########################
    843896
    844     int pthread_setaffinity_np( pthread_t /* __th */, size_t /* __cpusetsize */, __const cpu_set_t * /* __cpuset */ ) __THROW {
     897    int pthread_setaffinity_np( pthread_t /* __th */, size_t /* __cpusetsize */, __const cpu_set_t * /* __cpuset */ ) libcfa_public __THROW {
    845898            abort( "pthread_setaffinity_np" );
    846899    } // pthread_setaffinity_np
    847900
    848     int pthread_getaffinity_np( pthread_t /* __th */, size_t /* __cpusetsize */, cpu_set_t * /* __cpuset */ ) __THROW {
     901    int pthread_getaffinity_np( pthread_t /* __th */, size_t /* __cpusetsize */, cpu_set_t * /* __cpuset */ ) libcfa_public __THROW {
    849902            abort( "pthread_getaffinity_np" );
    850903    } // pthread_getaffinity_np
    851904
    852     int pthread_attr_setaffinity_np( pthread_attr_t * /* __attr */, size_t /* __cpusetsize */, __const cpu_set_t * /* __cpuset */ ) __THROW {
     905    int pthread_attr_setaffinity_np( pthread_attr_t * /* __attr */, size_t /* __cpusetsize */, __const cpu_set_t * /* __cpuset */ ) libcfa_public __THROW {
    853906            abort( "pthread_attr_setaffinity_np" );
    854907    } // pthread_attr_setaffinity_np
    855908
    856     int pthread_attr_getaffinity_np( __const pthread_attr_t * /* __attr */, size_t /* __cpusetsize */, cpu_set_t * /* __cpuset */ ) __THROW {
     909    int pthread_attr_getaffinity_np( __const pthread_attr_t * /* __attr */, size_t /* __cpusetsize */, cpu_set_t * /* __cpuset */ ) libcfa_public __THROW {
    857910            abort( "pthread_attr_getaffinity_np" );
    858911    } // pthread_attr_getaffinity_np
     
    860913    //######################### Cancellation #########################
    861914
    862     void _pthread_cleanup_push_defer( struct _pthread_cleanup_buffer * /* __buffer */, void( * /* __routine */ )( void * ), void * /* __arg */ ) __THROW {
     915    void _pthread_cleanup_push_defer( struct _pthread_cleanup_buffer * /* __buffer */, void( * /* __routine */ )( void * ), void * /* __arg */ ) libcfa_public __THROW {
    863916            abort( "_pthread_cleanup_push_defer" );
    864917    } // _pthread_cleanup_push_defer
    865918
    866     void _pthread_cleanup_pop_restore( struct _pthread_cleanup_buffer * /* __buffer */, int /* __execute */ ) __THROW {
     919    void _pthread_cleanup_pop_restore( struct _pthread_cleanup_buffer * /* __buffer */, int /* __execute */ ) libcfa_public __THROW {
    867920            abort( "_pthread_cleanup_pop_restore" );
    868921    } // _pthread_cleanup_pop_res
    869922
    870     int pthread_cancel( pthread_t threadID ) __THROW {
     923    int pthread_cancel( pthread_t threadID ) libcfa_public __THROW {
    871924        abort("pthread cancel not implemented");
    872925            return 0;
    873926    } // pthread_cancel
    874927
    875     int pthread_setcancelstate( int state, int *oldstate ) __THROW {
     928    int pthread_setcancelstate( int state, int *oldstate ) libcfa_public __THROW {
    876929        abort("pthread_setcancelstate not implemented");
    877930            return 0;
    878931    } // pthread_setcancelstate
    879932
    880     int pthread_setcanceltype( int type, int *oldtype ) __THROW {
     933    int pthread_setcanceltype( int type, int *oldtype ) libcfa_public __THROW {
    881934        abort("pthread_setcanceltype not implemented");
    882935            return 0;
    883936    } // pthread_setcanceltype
    884 }
     937} // extern "C"
     938
    885939#pragma GCC diagnostic pop
    886940
  • libcfa/src/interpose.cfa

    ra7d696f r20be782  
    114114        typeof(pthread_join) pthread_join;
    115115        typeof(pthread_self) pthread_self;
    116         typeof(pthread_cond_init) pthread_cond_init;
    117         typeof(pthread_cond_destroy) pthread_cond_destroy;
    118         typeof(pthread_cond_signal) pthread_cond_signal;
    119         typeof(pthread_cond_broadcast) pthread_cond_broadcast;
    120         typeof(pthread_cond_wait) pthread_cond_wait;
    121         typeof(pthread_mutex_init) pthread_mutex_init;
    122         typeof(pthread_mutex_lock) pthread_mutex_lock;
    123         typeof(pthread_mutex_trylock) pthread_mutex_trylock;
    124         typeof(pthread_mutex_unlock) pthread_mutex_unlock;
    125         typeof(pthread_mutex_destroy) pthread_mutex_destroy;
    126         typeof(pthread_attr_init ) pthread_attr_init;
     116        typeof(pthread_attr_init) pthread_attr_init;
    127117        typeof(pthread_attr_setstack ) pthread_attr_setstack;
    128118        typeof(pthread_attr_destroy) pthread_attr_destroy;
    129119        typeof(pthread_attr_getstacksize) pthread_attr_getstacksize;
     120        //typeof(pthread_sigmask) pthread_sigmask;
     121        //typeof(pthread_sigqueue) pthread_sigqueue;
    130122} __cabi_libc;
    131123
     
    146138                INTERPOSE_LIBC( pthread_join , version );
    147139                INTERPOSE_LIBC( pthread_self , version );
    148                 INTERPOSE_LIBC( pthread_mutex_init , version );
    149                 INTERPOSE_LIBC( pthread_mutex_lock , version );
    150                 INTERPOSE_LIBC( pthread_mutex_unlock , version );
    151                 INTERPOSE_LIBC( pthread_mutex_destroy , version );
    152                 INTERPOSE_LIBC( pthread_cond_init , version );
    153                 INTERPOSE_LIBC( pthread_cond_destroy , version );
    154                 INTERPOSE_LIBC( pthread_cond_signal , version );
    155                 INTERPOSE_LIBC( pthread_cond_broadcast , version );
    156                 INTERPOSE_LIBC( pthread_cond_wait , version );
    157140                INTERPOSE_LIBC( pthread_attr_init , version );
    158141                INTERPOSE_LIBC( pthread_attr_destroy , version );
    159142                INTERPOSE_LIBC( pthread_attr_setstack , version );
    160143                INTERPOSE_LIBC( pthread_attr_getstacksize , version );
     144                //INTERPOSE_LIBC( pthread_sigmask , version );
     145                //INTERPOSE_LIBC( pthread_sigqueue , version );
    161146#pragma GCC diagnostic pop
    162147
     
    232217                return __cabi_libc.pthread_self();
    233218        }
    234         /* mutex Default attr is PTHREAD_MUTEX_RECURSIVE*/
    235         libcfa_public int real_pthread_mutex_init(pthread_mutex_t *_mutex, const pthread_mutexattr_t *attr){
    236                 return __cabi_libc.pthread_mutex_init(_mutex, attr);
    237         }
    238         libcfa_public int real_pthread_mutex_destroy(pthread_mutex_t *_mutex){
    239                 return __cabi_libc.pthread_mutex_destroy(_mutex);
    240         }
    241         libcfa_public int real_pthread_mutex_lock(pthread_mutex_t *_mutex){
    242                 return __cabi_libc.pthread_mutex_lock(_mutex);
    243         }
    244         libcfa_public int real_pthread_mutex_unlock(pthread_mutex_t *_mutex){
    245                 return  __cabi_libc.pthread_mutex_unlock(_mutex);
    246         }
    247         libcfa_public int real_pthread_mutex_trylock(pthread_mutex_t *_mutex){
    248                 return __cabi_libc.pthread_mutex_trylock(_mutex);
    249         }
    250         libcfa_public int real_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr){
    251                 return __cabi_libc.pthread_cond_init(cond, attr);
    252         }
    253         libcfa_public int real_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *_mutex){
    254                 return __cabi_libc.pthread_cond_wait(cond, _mutex);
    255         }
    256         libcfa_public int real_pthread_cond_signal(pthread_cond_t *cond){
    257                 return __cabi_libc.pthread_cond_signal(cond);
    258         }
    259         libcfa_public int real_pthread_cond_broadcast(pthread_cond_t *cond){
    260                 return __cabi_libc.pthread_cond_broadcast(cond);
    261         }
    262         libcfa_public int real_pthread_cond_destroy(pthread_cond_t *cond){
    263                 return __cabi_libc.pthread_cond_destroy(cond);
    264         }
    265219        libcfa_public int real_pthread_attr_init(pthread_attr_t *attr){
    266220                return __cabi_libc.pthread_attr_init(attr);
     
    272226                return __cabi_libc.pthread_attr_setstack(attr, stackaddr, stacksize);
    273227        }
    274         libcfa_public int pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize ){
     228        libcfa_public int read_pthread_attr_getstacksize( const pthread_attr_t *attr, size_t *stacksize ){
    275229                return __cabi_libc.pthread_attr_getstacksize(attr, stacksize);
    276230        }
    277 
     231        // libcfa_public int real_pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset){
     232        //      return __cabi_libc.pthread_sigmask(how, set, oldset);
     233        // }
     234        // libcfa_public int real_pthread_sigqueue(pthread_t _thread, int sig, const union sigval value){
     235        //      return __cabi_libc.real_pthread_sigqueue(_thread, sig, value);
     236        // }
    278237}
    279238
  • tests/collections/stack.cfa

    ra7d696f r20be782  
    33#include <bits/stack.hfa>
    44
    5 struct Fred {
    6                 inline Colable;                                                                 // Plan 9 inheritance
    7                 int i;
    8 };
    9 
    10 Stack(Fred) fred;
    11 
    125int main() {
    136        // Fred test
    147
    15        
     8        struct Fred {
     9                inline Colable;                                                                 // Plan 9 inheritance
     10                int i;
     11        };
    1612        void ?{}( Fred & fred ) { abort(); }
    1713        void ?{}( Fred & fred, int p ) with( fred ) {
     
    2218        }
    2319
    24        
     20        Stack(Fred) fred;
    2521        StackIter(Fred) inter = { fred };
    2622        Fred & f;
Note: See TracChangeset for help on using the changeset viewer.