Changeset 20be782 for libcfa/src
- Timestamp:
- Aug 8, 2022, 1:00:27 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, 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)
- Location:
- libcfa/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/Makefile.am
ra7d696f r20be782 124 124 concurrency/monitor.hfa \ 125 125 concurrency/mutex.hfa \ 126 concurrency/thread.hfa 126 concurrency/thread.hfa 127 127 128 128 thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \ -
libcfa/src/bits/defs.hfa
ra7d696f r20be782 21 21 #include <stdint.h> 22 22 #include <assert.h> 23 #include <pthread.h> 23 24 24 25 25 #define likely(x) __builtin_expect(!!(x), 1) … … 44 44 void abort( bool signalAbort, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )); 45 45 extern "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 */ ); 66 57 } 67 58 #endif -
libcfa/src/concurrency/kernel/startup.cfa
ra7d696f r20be782 279 279 } 280 280 281 extern "C"{ 282 void pthread_delete_kernel_threads_(); 283 } 284 285 281 286 static void __kernel_shutdown(void) { 282 287 if(!cfa_main_returned) return; 288 289 //delete kernel threads for pthread_concurrency 290 pthread_delete_kernel_threads_(); 291 283 292 /* paranoid */ verify( __preemption_enabled() ); 284 293 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 // 1 15 2 16 #define __cforall_thread__ 3 17 #define _GNU_SOURCE 4 18 19 #include <pthread.h> 20 #include <errno.h> 5 21 #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 17 24 18 25 #pragma GCC diagnostic push 19 26 #pragma GCC diagnostic ignored "-Wnonnull-compare" 20 27 21 /* pthread key, pthread once */28 /* pthread key, pthread once inner routine mutual exclusion */ 22 29 static simple_owner_lock once_lock,key_lock,magic_mutex_check, concurrency_lock; 30 23 31 //######################### Local Storage Helpers ######################### 24 32 … … 32 40 33 41 34 Pthread_values *& Back( Pthread_values * n ) {42 static Pthread_values *& Back( Pthread_values * n ) { 35 43 return (Pthread_values *)Back( (Seqable *)n ); 36 44 } 37 Pthread_values *& Next( Pthread_values * n ) {45 static Pthread_values *& Next( Pthread_values * n ) { 38 46 return (Pthread_values *)Next( (Colable *)n ); 39 47 } … … 54 62 static Pthread_keys cfa_pthread_keys_storage[PTHREAD_KEYS_MAX] __attribute__((aligned (16))); 55 63 56 void init_pthread_storage(){64 static void init_pthread_storage(){ 57 65 for (int i = 0; i < PTHREAD_KEYS_MAX; i++){ 58 66 cfa_pthread_keys_storage[i]{}; … … 89 97 /* condvar helper routines */ 90 98 static 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)"); 91 100 cfa2pthr_cond_var_t* _cond = (cfa2pthr_cond_var_t*)pcond; 92 101 ?{}(*_cond); … … 94 103 95 104 static 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)"); 96 106 return (cfa2pthr_cond_var_t*)pcond; 97 107 } 98 108 99 109 static 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)"); 100 111 ^?{}(*get(cond)); 101 112 } … … 110 121 // SKULLDUGGERY: not a portable way to access the kind field, /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h 111 122 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 114 124 if ( _lock_val == 0 ) { // static initialized ? 115 125 lock(magic_mutex_check); // race … … 124 134 125 135 static 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)"); 126 137 simple_owner_lock* _lock = (simple_owner_lock*)plock; 127 138 ?{}(*_lock); … … 129 140 130 141 static 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)"); 131 143 return (simple_owner_lock*)plock; 132 144 } 133 145 134 146 static 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)"); 135 148 ^?{}(*get(plock)); 136 149 } … … 159 172 160 173 /* 161 cfaPthread_attr_t default_attrs = {174 static const cfaPthread_attr_t default_attrs = { 162 175 PTHREAD_SCOPE_SYSTEM, 163 176 PTHREAD_CREATE_JOINABLE, … … 171 184 172 185 186 173 187 static 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)"); 174 189 return (cfaPthread_attr_t*)attr; 175 190 } … … 178 193 //######################### Threads Helper ######################### 179 194 195 // exception for cancel_stack in pthread_exit 180 196 exception pthread_exit_exp {}; 181 197 static vtable(pthread_exit_exp) exp; … … 201 217 // generate pthread_t by cfaPthread ptr 202 218 static 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; 204 221 } 205 222 206 223 static cfaPthread *lookup( pthread_t p ){ 224 static_assert(sizeof(pthread_t) >= sizeof(cfaPthread*),"sizeof(pthread_t) < sizeof(cfaPthread*)"); 207 225 return (cfaPthread*)p; 208 226 } 209 227 210 void pthread_deletespecific_( Pthread_values* values ) { // see uMachContext::invokeTask228 static void pthread_deletespecific_( Pthread_values* values ) { // see uMachContext::invokeTask 211 229 Pthread_values* value; 212 230 Pthread_keys* key; … … 240 258 } 241 259 242 void ^?{}(cfaPthread & mutex t){243 // ^?{}((thread$&)t);260 static void ^?{}(cfaPthread & mutex t){ 261 // delete pthread local storage 244 262 Pthread_values* values = t.pthreadData; 245 263 pthread_deletespecific_(values); 246 PRINT(sout | "thread exited" | t.pthreadId;)247 264 } 248 265 … … 270 287 //######################### Pthread Attrs ######################### 271 288 272 int pthread_attr_init(pthread_attr_t *attr) {289 int pthread_attr_init(pthread_attr_t *attr) libcfa_public __THROW { 273 290 cfaPthread_attr_t* _attr = get(attr); 274 291 ?{}(*_attr); … … 276 293 return 0; 277 294 } 278 int pthread_attr_destroy(pthread_attr_t *attr) {295 int pthread_attr_destroy(pthread_attr_t *attr) libcfa_public __THROW { 279 296 ^?{}(*get(attr)); 280 297 return 0; 281 298 } 282 299 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 { 284 301 get( attr )->contentionscope = contentionscope; 285 302 return 0; 286 303 } // pthread_attr_setscope 287 304 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 { 289 306 *contentionscope = get( attr )->contentionscope; 290 307 return 0; 291 308 } // pthread_attr_getscope 292 309 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 { 294 311 get( attr )->detachstate = detachstate; 295 312 return 0; 296 313 } // pthread_attr_setdetachstate 297 314 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 { 299 316 *detachstate = get( attr )->detachstate; 300 317 return 0; 301 318 } // pthread_attr_getdetachstate 302 319 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 { 304 321 get( attr )->stacksize = stacksize; 305 322 return 0; 306 323 } // pthread_attr_setstacksize 307 324 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 { 309 326 *stacksize = get( attr )->stacksize; 310 327 return 0; 311 328 } // pthread_attr_getstacksize 312 329 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 { 314 331 return 0; 315 332 } // pthread_attr_getguardsize 316 333 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 { 318 335 return 0; 319 336 } // pthread_attr_setguardsize 320 337 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 { 322 339 get( attr )->stackaddr = stackaddr; 323 340 return 0; 324 341 } // pthread_attr_setstackaddr 325 342 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 { 327 344 *stackaddr = get( attr )->stackaddr; 328 345 return 0; 329 346 } // pthread_attr_getstackaddr 330 347 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 { 332 349 get( attr )->stackaddr = stackaddr; 333 350 get( attr )->stacksize = stacksize; … … 335 352 } // pthread_attr_setstack 336 353 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 { 338 355 *stackaddr = get( attr )->stackaddr; 339 356 *stacksize = get( attr )->stacksize; … … 344 361 // already running thread threadID. It shall be called on unitialized attr 345 362 // and destroyed with pthread_attr_destroy when no longer needed. 346 int pthread_getattr_np( pthread_t threadID, pthread_attr_t *attr ) __THROW { // GNU extension363 int pthread_getattr_np( pthread_t threadID, pthread_attr_t *attr ) libcfa_public __THROW { // GNU extension 347 364 // race condition during copy 348 365 cfaPthread_attr_t* _attr = get(attr); … … 358 375 //######################### Threads ######################### 359 376 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 { 361 378 cfaPthread *t = alloc(); 362 379 (*t){_thread, attr, start_routine, arg}; … … 367 384 368 385 369 int pthread_join(pthread_t _thread, void **value_ptr) {386 int pthread_join(pthread_t _thread, void **value_ptr) libcfa_public __THROW { 370 387 if (_thread == NULL) return EINVAL; // if thread is invalid 371 388 if (_thread == pthread_self()) return EDEADLK; … … 379 396 } //pthread_join_ 380 397 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 { 382 399 if (_thread == NULL) return EINVAL; // if thread is invalid 383 400 if (_thread == pthread_self()) return EDEADLK; … … 390 407 } //pthread_join_ 391 408 392 pthread_t pthread_self(void) {409 pthread_t pthread_self(void) libcfa_public __THROW { 393 410 return (pthread_t)((char*)active_thread()-(sizeof(cfaPthread)-sizeof(thread$))); 394 411 } //pthread_self_ 395 412 396 void pthread_exit(void * status) {413 void pthread_exit(void * status) libcfa_public __THROW { 397 414 pthread_t pid = pthread_self(); 398 415 cfaPthread* _thread = (cfaPthread*)pid; … … 402 419 } //pthread_exit_ 403 420 421 int pthread_yield( void ) __THROW { // GNU extension 422 yield(); 423 return 0; 424 } 404 425 405 426 406 427 //######################### Mutex ######################### 407 428 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 { 409 430 if (_mutex == NULL) return EINVAL; 410 431 … … 414 435 415 436 416 int pthread_mutex_destroy(pthread_mutex_t *_mutex) {437 int pthread_mutex_destroy(pthread_mutex_t *_mutex) libcfa_public __THROW{ 417 438 if (_mutex == NULL){ 418 439 return EINVAL; … … 426 447 } //pthread_mutex_destroy_ 427 448 428 int pthread_mutex_lock(pthread_mutex_t *_mutex) {449 int pthread_mutex_lock(pthread_mutex_t *_mutex) libcfa_public __THROW{ 429 450 if (_mutex == NULL) { 430 451 return EINVAL; … … 436 457 } //pthread_mutex_lock_ 437 458 438 int pthread_mutex_unlock(pthread_mutex_t *_mutex) {459 int pthread_mutex_unlock(pthread_mutex_t *_mutex) libcfa_public __THROW{ 439 460 if (_mutex == NULL) { 440 461 return EINVAL; … … 448 469 } //pthread_mutex_unlock_ 449 470 450 int pthread_mutex_trylock(pthread_mutex_t *_mutex) {471 int pthread_mutex_trylock(pthread_mutex_t *_mutex) libcfa_public __THROW{ 451 472 if (_mutex == NULL) { 452 473 return EINVAL; … … 463 484 464 485 /* 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 { 466 487 if (cond == NULL) return EINVAL; 467 488 init(cond); 468 489 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 { 471 493 if (cond == NULL || _mutex == NULL){ 472 494 return EINVAL; … … 474 496 wait(*get(cond), *get(_mutex)); 475 497 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 { 479 501 if (cond == NULL || _mutex == NULL){ 480 502 return EINVAL; … … 482 504 wait(*get(cond), *get(_mutex), *abstime); 483 505 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 { 488 509 if (cond == NULL){ 489 510 return EINVAL; 490 511 } // invalid cond 491 512 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 { 494 516 if (cond == NULL){ 495 517 return EINVAL; 496 518 } // invalid cond 497 519 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 { 500 523 if (cond == NULL){ 501 524 return EINVAL; … … 503 526 destroy(cond); 504 527 return 0; 505 } 528 } // pthread_cond_destroy 506 529 507 530 … … 509 532 //######################### Local storage ######################### 510 533 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 } 512 542 lock(once_lock); 513 543 if ( *((int *)once_control) == 0 ) { … … 517 547 unlock(once_lock); 518 548 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 { 522 552 lock(key_lock); 523 553 for ( int i = 0; i < PTHREAD_KEYS_MAX; i += 1 ) { … … 534 564 } // pthread_key_create 535 565 536 int pthread_key_delete( pthread_key_t key ) {566 int pthread_key_delete( pthread_key_t key ) libcfa_public __THROW { 537 567 lock(key_lock); 538 568 if ( key >= PTHREAD_KEYS_MAX || ! cfa_pthread_keys[key].in_use ) { … … 554 584 } // pthread_key_delete 555 585 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 { 557 587 // get current thread 558 588 cfaPthread* t = lookup(pthread_self()); … … 585 615 } //pthread_setspecific 586 616 587 void* pthread_getspecific(pthread_key_t key) {617 void* pthread_getspecific(pthread_key_t key) libcfa_public __THROW { 588 618 if (key >= PTHREAD_KEYS_MAX || ! cfa_pthread_keys[key].in_use) return NULL; 589 619 … … 604 634 605 635 //######################### Parallelism ######################### 606 void pthread_delete_kernel_threads_() { // see uMain::~uMain636 void pthread_delete_kernel_threads_() libcfa_public __THROW { // see uMain::~uMain 607 637 Pthread_kernel_threads& p; 608 638 for ( StackIter(Pthread_kernel_threads) iter = {cfa_pthreads_kernel_threads}; iter | p; ) { … … 611 641 } // pthread_delete_kernel_threads_ 612 642 613 int pthread_getconcurrency( void ) { // XOPEN extension643 int pthread_getconcurrency( void ) libcfa_public __THROW { // XOPEN extension 614 644 return cfa_pthreads_kernel_threads_zero ? 0 : cfa_pthreads_no_kernel_threads; 615 645 } // pthread_getconcurrency 616 646 617 int pthread_setconcurrency( int new_level ) { // XOPEN extension647 int pthread_setconcurrency( int new_level ) libcfa_public __THROW { // XOPEN extension 618 648 if ( new_level < 0 ) return EINVAL; 619 649 if ( new_level == 0 ) { … … 633 663 } // pthread_setconcurrency 634 664 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 635 685 //######################### 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; 641 694 } // pthread_setschedparam 642 695 643 int pthread_getschedparam( pthread_t /* thread */, int */* policy */, struct sched_param * /* param */ ) __THROW {644 645 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; 646 699 } // pthread_getschedparam 647 700 648 701 //######################### Mutex Attr ######################### 649 702 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; 652 705 } // pthread_mutexattr_init 653 706 654 int pthread_mutexattr_destroy( pthread_mutexattr_t * /* attr */ ) __THROW {707 int pthread_mutexattr_destroy( pthread_mutexattr_t * /* attr */ ) libcfa_public __THROW { 655 708 return 0; 656 709 } // pthread_mutexattr_destroy 657 710 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 { 659 712 return 0; 660 713 } // pthread_mutexattr_setpshared 661 714 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 { 663 716 return 0; 664 717 } // pthread_mutexattr_getpshared 665 718 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 { 667 720 return 0; 668 721 } // pthread_mutexattr_setprotocol 669 722 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 { 671 724 return 0; 672 725 } // pthread_mutexattr_getprotocol 673 726 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 { 675 728 return 0; 676 729 } // pthread_mutexattr_setprioceiling 677 730 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 { 679 732 return 0; 680 733 } // pthread_mutexattr_getprioceiling 681 734 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 { 683 736 return 0; 684 737 } // pthread_mutex_setprioceiling 685 738 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 { 687 740 return 0; 688 741 } // pthread_mutex_getprioceiling 689 742 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 { 691 744 return 0; 692 745 } // pthread_mutexattr_gettype 693 746 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 { 695 748 return 0; 696 749 } // pthread_mutexattr_settype … … 698 751 //######################### Mutex ######################### 699 752 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 { 701 754 abort( "pthread_mutex_timedlock" ); 702 755 } // pthread_mutex_timedlock … … 704 757 //######################### Condition ######################### 705 758 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 { 707 760 abort( "pthread_condattr_getclock" ); 708 761 } // pthread_condattr_getclock 709 762 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 { 711 764 abort( "pthread_condattr_setclock" ); 712 765 } // pthread_condattr_setclock … … 714 767 //######################### Spinlock ######################### 715 768 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 { 717 770 abort( "pthread_spin_init" ); 718 771 } // pthread_spin_init 719 772 720 int pthread_spin_destroy( pthread_spinlock_t * /* __lock */ ) __THROW {773 int pthread_spin_destroy( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW { 721 774 abort( "pthread_spin_destroy" ); 722 775 } // pthread_spin_destroy 723 776 724 int pthread_spin_lock( pthread_spinlock_t * /* __lock */ ) __THROW {777 int pthread_spin_lock( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW { 725 778 abort( "pthread_spin_lock" ); 726 779 } // pthread_spin_lock 727 780 728 int pthread_spin_trylock( pthread_spinlock_t * /* __lock */ ) __THROW {781 int pthread_spin_trylock( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW { 729 782 abort( "pthread_spin_trylock" ); 730 783 } // pthread_spin_trylock 731 784 732 int pthread_spin_unlock( pthread_spinlock_t * /* __lock */ ) __THROW {785 int pthread_spin_unlock( pthread_spinlock_t * /* __lock */ ) libcfa_public __THROW { 733 786 abort( "pthread_spin_unlock" ); 734 787 } // pthread_spin_unlock … … 736 789 //######################### Barrier ######################### 737 790 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 { 739 792 abort( "pthread_barrier_init" ); 740 793 } // pthread_barrier_init 741 794 742 int pthread_barrier_destroy( pthread_barrier_t * /* __barrier */ ) __THROW {795 int pthread_barrier_destroy( pthread_barrier_t * /* __barrier */ ) libcfa_public __THROW { 743 796 abort( "pthread_barrier_destroy" ); 744 797 } // pthread_barrier_destroy 745 798 746 int pthread_barrier_wait( pthread_barrier_t * /* __barrier */ ) __THROW {799 int pthread_barrier_wait( pthread_barrier_t * /* __barrier */ ) libcfa_public __THROW { 747 800 abort( "pthread_barrier_wait" ); 748 801 } // pthread_barrier_wait 749 802 750 int pthread_barrierattr_init( pthread_barrierattr_t * /* __attr */ ) __THROW {803 int pthread_barrierattr_init( pthread_barrierattr_t * /* __attr */ ) libcfa_public __THROW { 751 804 abort( "pthread_barrierattr_init" ); 752 805 } // pthread_barrierattr_init 753 806 754 int pthread_barrierattr_destroy( pthread_barrierattr_t * /* __attr */ ) __THROW {807 int pthread_barrierattr_destroy( pthread_barrierattr_t * /* __attr */ ) libcfa_public __THROW { 755 808 abort( "pthread_barrierattr_destroy" ); 756 809 } // pthread_barrierattr_destroy 757 810 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 { 759 812 abort( "pthread_barrierattr_getpshared" ); 760 813 } // pthread_barrierattr_getpshared 761 814 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 { 763 816 abort( "pthread_barrierattr_setpshared" ); 764 817 } // pthread_barrierattr_setpshared … … 766 819 //######################### Clock ######################### 767 820 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 { 769 822 abort( "pthread_getcpuclockid" ); 770 823 } // pthread_getcpuclockid … … 776 829 //######################### Read/Write ######################### 777 830 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 { 779 832 abort( "pthread_rwlock_init" ); 780 833 } // pthread_rwlock_init 781 834 782 int pthread_rwlock_destroy( pthread_rwlock_t * /* __rwlock */ ) __THROW {835 int pthread_rwlock_destroy( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW { 783 836 abort( "pthread_rwlock_destroy" ); 784 837 } // pthread_rwlock_destroy 785 838 786 int pthread_rwlock_rdlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {839 int pthread_rwlock_rdlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW { 787 840 abort( "pthread_rwlock_rdlock" ); 788 841 } // pthread_rwlock_rdlock 789 842 790 int pthread_rwlock_tryrdlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {843 int pthread_rwlock_tryrdlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW { 791 844 abort( "pthread_rwlock_tryrdlock" ); 792 845 } // pthread_rwlock_tryrdlock 793 846 794 int pthread_rwlock_wrlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {847 int pthread_rwlock_wrlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW { 795 848 abort( "pthread_rwlock_wrlock" ); 796 849 } // pthread_rwlock_wrlock 797 850 798 int pthread_rwlock_trywrlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {851 int pthread_rwlock_trywrlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW { 799 852 abort( "pthread_rwlock_trywrlock" ); 800 853 } // pthread_rwlock_trywrlock 801 854 802 int pthread_rwlock_unlock( pthread_rwlock_t * /* __rwlock */ ) __THROW {855 int pthread_rwlock_unlock( pthread_rwlock_t * /* __rwlock */ ) libcfa_public __THROW { 803 856 abort( "pthread_rwlock_unlock" ); 804 857 } // pthread_rwlock_unlock 805 858 806 int pthread_rwlockattr_init( pthread_rwlockattr_t * /* __attr */ ) __THROW {859 int pthread_rwlockattr_init( pthread_rwlockattr_t * /* __attr */ ) libcfa_public __THROW { 807 860 abort( "pthread_rwlockattr_init" ); 808 861 } // pthread_rwlockattr_init 809 862 810 int pthread_rwlockattr_destroy( pthread_rwlockattr_t * /*__attr */ ) __THROW {863 int pthread_rwlockattr_destroy( pthread_rwlockattr_t * /*__attr */ ) libcfa_public __THROW { 811 864 abort( "pthread_rwlockattr_destroy" ); 812 865 } // pthread_rwlockattr_destroy 813 866 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 { 815 868 abort( "pthread_rwlockattr_getpshared" ); 816 869 } // pthread_rwlockattr_getpshared 817 870 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 { 819 872 abort( "pthread_rwlockattr_setpshared" ); 820 873 } // pthread_rwlockattr_setpshared 821 874 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 { 823 876 abort( "pthread_rwlockattr_getkind_np" ); 824 877 } // pthread_rwlockattr_getkind_np 825 878 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 { 827 880 abort( "pthread_rwlockattr_setkind_np" ); 828 881 } // pthread_rwlockattr_setkind_np … … 830 883 // UNIX98 + XOPEN 831 884 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 { 833 886 abort( "pthread_rwlock_timedrdlock" ); 834 887 } // pthread_rwlock_timedrdlock 835 888 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 { 837 890 abort( "pthread_rwlock_timedwrlock" ); 838 891 } // pthread_rwlock_timedwrlock … … 842 895 //######################### Parallelism ######################### 843 896 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 { 845 898 abort( "pthread_setaffinity_np" ); 846 899 } // pthread_setaffinity_np 847 900 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 { 849 902 abort( "pthread_getaffinity_np" ); 850 903 } // pthread_getaffinity_np 851 904 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 { 853 906 abort( "pthread_attr_setaffinity_np" ); 854 907 } // pthread_attr_setaffinity_np 855 908 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 { 857 910 abort( "pthread_attr_getaffinity_np" ); 858 911 } // pthread_attr_getaffinity_np … … 860 913 //######################### Cancellation ######################### 861 914 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 { 863 916 abort( "_pthread_cleanup_push_defer" ); 864 917 } // _pthread_cleanup_push_defer 865 918 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 { 867 920 abort( "_pthread_cleanup_pop_restore" ); 868 921 } // _pthread_cleanup_pop_res 869 922 870 int pthread_cancel( pthread_t threadID ) __THROW {923 int pthread_cancel( pthread_t threadID ) libcfa_public __THROW { 871 924 abort("pthread cancel not implemented"); 872 925 return 0; 873 926 } // pthread_cancel 874 927 875 int pthread_setcancelstate( int state, int *oldstate ) __THROW {928 int pthread_setcancelstate( int state, int *oldstate ) libcfa_public __THROW { 876 929 abort("pthread_setcancelstate not implemented"); 877 930 return 0; 878 931 } // pthread_setcancelstate 879 932 880 int pthread_setcanceltype( int type, int *oldtype ) __THROW {933 int pthread_setcanceltype( int type, int *oldtype ) libcfa_public __THROW { 881 934 abort("pthread_setcanceltype not implemented"); 882 935 return 0; 883 936 } // pthread_setcanceltype 884 } 937 } // extern "C" 938 885 939 #pragma GCC diagnostic pop 886 940 -
libcfa/src/interpose.cfa
ra7d696f r20be782 114 114 typeof(pthread_join) pthread_join; 115 115 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; 127 117 typeof(pthread_attr_setstack ) pthread_attr_setstack; 128 118 typeof(pthread_attr_destroy) pthread_attr_destroy; 129 119 typeof(pthread_attr_getstacksize) pthread_attr_getstacksize; 120 //typeof(pthread_sigmask) pthread_sigmask; 121 //typeof(pthread_sigqueue) pthread_sigqueue; 130 122 } __cabi_libc; 131 123 … … 146 138 INTERPOSE_LIBC( pthread_join , version ); 147 139 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 );157 140 INTERPOSE_LIBC( pthread_attr_init , version ); 158 141 INTERPOSE_LIBC( pthread_attr_destroy , version ); 159 142 INTERPOSE_LIBC( pthread_attr_setstack , version ); 160 143 INTERPOSE_LIBC( pthread_attr_getstacksize , version ); 144 //INTERPOSE_LIBC( pthread_sigmask , version ); 145 //INTERPOSE_LIBC( pthread_sigqueue , version ); 161 146 #pragma GCC diagnostic pop 162 147 … … 232 217 return __cabi_libc.pthread_self(); 233 218 } 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 }265 219 libcfa_public int real_pthread_attr_init(pthread_attr_t *attr){ 266 220 return __cabi_libc.pthread_attr_init(attr); … … 272 226 return __cabi_libc.pthread_attr_setstack(attr, stackaddr, stacksize); 273 227 } 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 ){ 275 229 return __cabi_libc.pthread_attr_getstacksize(attr, stacksize); 276 230 } 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 // } 278 237 } 279 238
Note: See TracChangeset
for help on using the changeset viewer.