Changes in / [dd53f75:17b6fc9]


Ignore:
Files:
2 added
7 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/main.cfa

    rdd53f75 r17b6fc9  
    125125                                                workers[i].flags   = 0;
    126126                                        }
    127                                         unpark( workers[i] );
     127                                        unpark( workers[i] __cfaabi_dbg_ctx2 );
    128128                                }
    129129                                printf("%d workers started on %d processors\n", options.clopts.nworkers, options.clopts.nprocs);
  • benchmark/io/http/worker.cfa

    rdd53f75 r17b6fc9  
    2222
    2323void main( Worker & this ) {
    24         park();
     24        park( __cfaabi_dbg_ctx );
    2525        /* paranoid */ assert( this.pipe[0] != -1 );
    2626        /* paranoid */ assert( this.pipe[1] != -1 );
  • benchmark/io/readv.cfa

    rdd53f75 r17b6fc9  
    5454
    5555void main( Reader & ) {
    56         park();
     56        park( __cfaabi_dbg_ctx );
    5757        /* paranoid */ assert( true == __atomic_load_n(&run, __ATOMIC_RELAXED) );
    5858
     
    151151
    152152                                for(i; nthreads) {
    153                                         unpark( threads[i] );
     153                                        unpark( threads[i] __cfaabi_dbg_ctx2 );
    154154                                }
    155155                                wait(duration, start, end, is_tty);
  • benchmark/readyQ/yield.cfa

    rdd53f75 r17b6fc9  
    3232
    3333void main( Yielder & this ) {
    34         park();
     34        park( __cfaabi_dbg_ctx );
    3535        /* paranoid */ assert( true == __atomic_load_n(&run, __ATOMIC_RELAXED) );
    3636
     
    7070
    7171                                for(i; nthreads) {
    72                                         unpark( threads[i] );
     72                                        unpark( threads[i] __cfaabi_dbg_ctx2 );
    7373                                }
    7474                                wait(duration, start, end, is_tty);
  • doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp

    rdd53f75 r17b6fc9  
    1 #include "thrdlib/thread.hpp"
     1#include "thrdlib/thread.h"
    22
    33#include <cassert>
     
    55#include <algorithm>
    66#include <atomic>
    7 #include <iostream>
    87#include <memory>
    98#include <vector>
    109
    1110#include <getopt.h>
    12 using thrdlib::thread_t;
    13 
    14 
    15 extern __attribute__((aligned(128))) thread_local struct {
    16         void * volatile this_thread;
    17         void * volatile this_processor;
    18         void * volatile this_stats;
    19 
    20         struct {
    21                 volatile unsigned short disable_count;
    22                 volatile bool enabled;
    23                 volatile bool in_progress;
    24         } preemption_state;
    25 
    26         #if defined(__SIZEOF_INT128__)
    27                 __uint128_t rand_seed;
    28         #else
    29                 uint64_t rand_seed;
    30         #endif
    31         struct {
    32                 uint64_t fwd_seed;
    33                 uint64_t bck_seed;
    34         } ready_rng;
    35 } kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
    3611
    3712//--------------------
     
    6136                        assert( expected == reset );
    6237                        if( std::atomic_compare_exchange_strong( &state, &expected, self) ) {
    63                                 thrdlib::park( self );
     38                                thrdlib_park( self );
    6439                                ret = true;
    6540                                goto END;
     
    7954                if( got == reset ) return false;
    8055
    81                 thrdlib::unpark( got );
     56                thrdlib_unpark( got );
    8257                return true;
    8358        }
     
    134109        the_stats_thread = self;
    135110        fence();
    136         thrdlib::park( self );
     111        thrdlib_park( self );
    137112
    138113        std::vector<bool> seen;
     
    140115
    141116        while(last_produced < nproduce) {
    142                 thrdlib::yield();
     117                thrdlib_yield();
    143118                thrd_stats.stats.ran++;
    144119                if( last_produced > 0 ) seen.at(last_produced - 1) = true;
     
    172147
    173148void Renderer( thread_t self ) {
    174         thrdlib::unpark( the_stats_thread );
     149        thrdlib_unpark( the_stats_thread );
    175150        for(unsigned i = 0; i < nproduce; i++) {
    176151                auto & frame = frames[i % nframes];
     
    203178        fsize    = 1000;
    204179        nproduce = 60;
    205 
    206         const char * framework;
    207180
    208181        for(;;) {
     
    223196                        case -1:
    224197                                /* paranoid */ assert(optind <= argc);
    225                                 if( optind == argc ) {
    226                                         std::cerr << "Must specify a framework" << std::endl;
    227                                         goto usage;
    228 
    229                                 }
    230                                 framework = argv[optind];
    231198                                goto run;
    232199                        case 'b':
     
    261228                                std::cerr << opt << std::endl;
    262229                        usage:
    263                                 std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl;
     230                                std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
    264231                                std::cerr << std::endl;
    265232                                std::cerr << "  -b, --buff=COUNT    Number of frames to buffer" << std::endl;
     
    270237        }
    271238        run:
    272         assert( framework );
    273239
    274240        frames.reset(new Frame[nframes]);
     
    280246        std::cout << "(Buffering " << nframes << ")" << std::endl;
    281247
    282         thrdlib::init( framework, 2 );
    283 
    284         thread_t stats     = thrdlib::create( Stats );
     248        thrdlib_setproccnt( 2 );
     249
     250        thread_t stats     = thrdlib_create( Stats    );
    285251        std::cout << "Created Stats Thread" << std::endl;
    286         while( the_stats_thread == nullptr ) thrdlib::yield();
    287 
     252        while( the_stats_thread == nullptr ) thrdlib_yield();
    288253        std::cout << "Creating Main Threads" << std::endl;
    289         thread_t renderer  = thrdlib::create( Renderer  );
    290         thread_t simulator = thrdlib::create( Simulator );
     254        thread_t renderer  = thrdlib_create( Renderer  );
     255        // while(true);
     256        thread_t simulator = thrdlib_create( Simulator );
    291257
    292258        std::cout << "Running" << std::endl;
    293259
    294         thrdlib::join( simulator );
    295         thrdlib::join( renderer  );
    296         thrdlib::join( stats     );
    297 
    298         thrdlib::clean();
     260        thrdlib_join( simulator );
     261        thrdlib_join( renderer  );
     262        thrdlib_join( stats     );
    299263
    300264        std::cout << "----------" << std::endl;
  • libcfa/src/bits/locks.hfa

    rdd53f75 r17b6fc9  
    164164
    165165        struct $thread;
    166         extern void park( void );
    167         extern void unpark( struct $thread * this );
     166        extern void park( __cfaabi_dbg_ctx_param );
     167        extern void unpark( struct $thread * this __cfaabi_dbg_ctx_param2 );
    168168        static inline struct $thread * active_thread ();
    169169
     
    191191                                        /* paranoid */ verify( expected == 0p );
    192192                                        if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    193                                                 park();
     193                                                park( __cfaabi_dbg_ctx );
    194194                                                return true;
    195195                                        }
     
    210210                                else {
    211211                                        if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    212                                                 unpark( expected );
     212                                                unpark( expected __cfaabi_dbg_ctx2 );
    213213                                                return true;
    214214                                        }
     
    244244                                /* paranoid */ verify( expected == 0p );
    245245                                if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    246                                         park();
     246                                        park( __cfaabi_dbg_ctx );
    247247                                        /* paranoid */ verify( this.ptr == 1p );
    248248                                        return true;
     
    256256                        struct $thread * got = __atomic_exchange_n( &this.ptr, 1p, __ATOMIC_SEQ_CST);
    257257                        if( got == 0p ) return false;
    258                         unpark( got );
     258                        unpark( got __cfaabi_dbg_ctx2 );
    259259                        return true;
    260260                }
  • libcfa/src/concurrency/alarm.cfa

    rdd53f75 r17b6fc9  
    130130
    131131        register_self( &node );
    132         park();
     132        park( __cfaabi_dbg_ctx );
    133133
    134134        /* paranoid */ verify( !node.set );
  • libcfa/src/concurrency/clib/cfathread.cfa

    rdd53f75 r17b6fc9  
    3434extern "C" {
    3535        //--------------------
    36         // Basic thread management
     36        // Basic thread managenemt
    3737        CRunner * cfathread_create( void (*main)( CRunner * ) ) {
    3838                return new( main );
     
    4444
    4545        void cfathread_park( void ) {
    46                 park();
     46                park( __cfaabi_dbg_ctx );
    4747        }
    4848
    4949        void cfathread_unpark( CRunner * thrd ) {
    50                 unpark( *thrd );
     50                unpark( *thrd __cfaabi_dbg_ctx2 );
    5151        }
    5252
  • libcfa/src/concurrency/clib/cfathread.h

    rdd53f75 r17b6fc9  
    1717#include "invoke.h"
    1818
    19 #if defined(__cforall) || defined(__cplusplus)
     19#if defined(__cforall) || defined(__cpluplus)
    2020extern "C" {
    2121#endif
     
    3939
    4040
    41 #if defined(__cforall) || defined(__cplusplus)
     41#if defined(__cforall) || defined(__cpluplus)
    4242}
    4343#endif
  • libcfa/src/concurrency/invoke.h

    rdd53f75 r17b6fc9  
    9393
    9494        };
    95         // Wrapper for gdb
    96         struct cfathread_coroutine_t { struct $coroutine debug; };
    9795
    9896        static inline struct __stack_t * __get_stack( struct $coroutine * cor ) {
     
    131129                struct __condition_node_t * dtor_node;
    132130        };
    133         // Wrapper for gdb
    134         struct cfathread_monitor_t { struct $monitor debug; };
    135131
    136132        struct __monitor_group_t {
     
    190186                } node;
    191187
    192                 #if defined( __CFA_WITH_VERIFY__ )
    193                         unsigned long long canary;
     188                #ifdef __CFA_DEBUG__
     189                        // previous function to park/unpark the thread
     190                        const char * park_caller;
     191                        int park_result;
     192                        enum __Coroutine_State park_state;
     193                        bool park_stale;
     194                        const char * unpark_caller;
     195                        int unpark_result;
     196                        enum __Coroutine_State unpark_state;
     197                        bool unpark_stale;
    194198                #endif
    195199        };
    196         // Wrapper for gdb
    197         struct cfathread_thread_t { struct $thread debug; };
    198200
    199201        #ifdef __CFA_DEBUG__
  • libcfa/src/concurrency/io.cfa

    rdd53f75 r17b6fc9  
    6969                if( block ) {
    7070                        enable_interrupts( __cfaabi_dbg_ctx );
    71                         park();
     71                        park( __cfaabi_dbg_ctx );
    7272                        disable_interrupts();
    7373                }
     
    9797
    9898                if(nextt) {
    99                         unpark( nextt );
     99                        unpark( nextt __cfaabi_dbg_ctx2 );
    100100                        enable_interrupts( __cfaabi_dbg_ctx );
    101101                        return true;
  • libcfa/src/concurrency/io/setup.cfa

    rdd53f75 r17b6fc9  
    247247                                        thrd.link.next = 0p;
    248248                                        thrd.link.prev = 0p;
     249                                        __cfaabi_dbg_debug_do( thrd.unpark_stale = true );
    249250
    250251                                        // Fixup the thread state
  • libcfa/src/concurrency/kernel.cfa

    rdd53f75 r17b6fc9  
    246246                thrd_dst->state = Active;
    247247
     248                __cfaabi_dbg_debug_do(
     249                        thrd_dst->park_stale   = true;
     250                        thrd_dst->unpark_stale = true;
     251                )
    248252                // Update global state
    249253                kernelTLS.this_thread = thrd_dst;
     
    251255                /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    252256                /* paranoid */ verify( kernelTLS.this_thread == thrd_dst );
    253                 /* paranoid */ verify( thrd_dst->context.SP );
    254257                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor
    255258                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor
    256                 /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_dst->canary );
    257 
    258259
    259260
    260261                // set context switch to the thread that the processor is executing
     262                verify( thrd_dst->context.SP );
    261263                __cfactx_switch( &proc_cor->context, &thrd_dst->context );
    262264                // when __cfactx_switch returns we are back in the processor coroutine
    263265
    264                 /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_dst->canary );
    265266                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst );
    266267                /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ), "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst );
    267                 /* paranoid */ verify( thrd_dst->context.SP );
    268268                /* paranoid */ verify( kernelTLS.this_thread == thrd_dst );
    269269                /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
     
    288288                        // The thread has halted, it should never be scheduled/run again
    289289                        // We may need to wake someone up here since
    290                         unpark( this->destroyer );
     290                        unpark( this->destroyer __cfaabi_dbg_ctx2 );
    291291                        this->destroyer = 0p;
    292292                        break RUNNING;
     
    298298                // set state of processor coroutine to active and the thread to inactive
    299299                int old_ticket = __atomic_fetch_sub(&thrd_dst->ticket, 1, __ATOMIC_SEQ_CST);
     300                __cfaabi_dbg_debug_do( thrd_dst->park_result = old_ticket; )
    300301                switch(old_ticket) {
    301302                        case 1:
     
    334335                        __x87_store;
    335336                #endif
    336                 /* paranoid */ verify( proc_cor->context.SP );
    337                 /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_src->canary );
     337                verify( proc_cor->context.SP );
    338338                __cfactx_switch( &thrd_src->context, &proc_cor->context );
    339                 /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd_src->canary );
    340339                #if defined( __i386 ) || defined( __x86_64 )
    341340                        __x87_load;
     
    369368        /* paranoid */ #endif
    370369        /* paranoid */ verifyf( thrd->link.next == 0p, "Expected null got %p", thrd->link.next );
    371         /* paranoid */ verify( 0x0D15EA5E0D15EA5E == thrd->canary );
    372 
    373370
    374371        if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready;
     
    407404
    408405// KERNEL ONLY unpark with out disabling interrupts
    409 void __unpark(  struct __processor_id_t * id, $thread * thrd ) {
     406void __unpark(  struct __processor_id_t * id, $thread * thrd __cfaabi_dbg_ctx_param2 ) {
     407        // record activity
     408        __cfaabi_dbg_record_thrd( *thrd, false, caller );
     409
    410410        int old_ticket = __atomic_fetch_add(&thrd->ticket, 1, __ATOMIC_SEQ_CST);
     411        __cfaabi_dbg_debug_do( thrd->unpark_result = old_ticket; thrd->unpark_state = thrd->state; )
    411412        switch(old_ticket) {
    412413                case 1:
     
    426427}
    427428
    428 void unpark( $thread * thrd ) {
     429void unpark( $thread * thrd __cfaabi_dbg_ctx_param2 ) {
    429430        if( !thrd ) return;
    430431
    431432        disable_interrupts();
    432         __unpark( (__processor_id_t*)kernelTLS.this_processor, thrd );
     433        __unpark( (__processor_id_t*)kernelTLS.this_processor, thrd __cfaabi_dbg_ctx_fwd2 );
    433434        enable_interrupts( __cfaabi_dbg_ctx );
    434435}
    435436
    436 void park( void ) {
     437void park( __cfaabi_dbg_ctx_param ) {
    437438        /* paranoid */ verify( kernelTLS.preemption_state.enabled );
    438439        disable_interrupts();
    439440        /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    440441        /* paranoid */ verify( kernelTLS.this_thread->preempted == __NO_PREEMPTION );
     442
     443        // record activity
     444        __cfaabi_dbg_record_thrd( *kernelTLS.this_thread, true, caller );
    441445
    442446        returnToKernel();
     
    646650                // atomically release spin lock and block
    647651                unlock( lock );
    648                 park();
     652                park( __cfaabi_dbg_ctx );
    649653                return true;
    650654        }
     
    667671
    668672        // make new owner
    669         unpark( thrd );
     673        unpark( thrd __cfaabi_dbg_ctx2 );
    670674
    671675        return thrd != 0p;
     
    678682        count += diff;
    679683        for(release) {
    680                 unpark( pop_head( waiting ) );
     684                unpark( pop_head( waiting ) __cfaabi_dbg_ctx2 );
    681685        }
    682686
     
    694698                        this.prev_thrd = kernelTLS.this_thread;
    695699                }
     700
     701                void __cfaabi_dbg_record_thrd($thread & this, bool park, const char prev_name[]) {
     702                        if(park) {
     703                                this.park_caller   = prev_name;
     704                                this.park_stale    = false;
     705                        }
     706                        else {
     707                                this.unpark_caller = prev_name;
     708                                this.unpark_stale  = false;
     709                        }
     710                }
    696711        }
    697712)
  • libcfa/src/concurrency/kernel/fwd.hfa

    rdd53f75 r17b6fc9  
    118118
    119119        extern "Cforall" {
    120                 extern void park( void );
    121                 extern void unpark( struct $thread * this );
     120                extern void park( __cfaabi_dbg_ctx_param );
     121                extern void unpark( struct $thread * this __cfaabi_dbg_ctx_param2 );
    122122                static inline struct $thread * active_thread () { return TL_GET( this_thread ); }
    123123
  • libcfa/src/concurrency/kernel/startup.cfa

    rdd53f75 r17b6fc9  
    451451        link.next = 0p;
    452452        link.prev = 0p;
    453         #if defined( __CFA_WITH_VERIFY__ )
    454                 canary = 0x0D15EA5E0D15EA5E;
    455         #endif
    456453
    457454        node.next = 0p;
  • libcfa/src/concurrency/kernel_private.hfa

    rdd53f75 r17b6fc9  
    6464
    6565// KERNEL ONLY unpark with out disabling interrupts
    66 void __unpark( struct __processor_id_t *, $thread * thrd );
     66void __unpark( struct __processor_id_t *, $thread * thrd __cfaabi_dbg_ctx_param2 );
    6767
    6868static inline bool __post(single_sem & this, struct __processor_id_t * id) {
     
    7777                else {
    7878                        if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    79                                 __unpark( id, expected );
     79                                __unpark( id, expected __cfaabi_dbg_ctx2 );
    8080                                return true;
    8181                        }
  • libcfa/src/concurrency/monitor.cfa

    rdd53f75 r17b6fc9  
    122122
    123123                unlock( this->lock );
    124                 park();
     124                park( __cfaabi_dbg_ctx );
    125125
    126126                __cfaabi_dbg_print_safe( "Kernel : %10p Entered  mon %p\n", thrd, this);
     
    201201                // Release the next thread
    202202                /* paranoid */ verifyf( urgent->owner->waiting_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, this->owner, this->recursion, this );
    203                 unpark( urgent->owner->waiting_thread );
     203                unpark( urgent->owner->waiting_thread __cfaabi_dbg_ctx2 );
    204204
    205205                // Park current thread waiting
    206                 park();
     206                park( __cfaabi_dbg_ctx );
    207207
    208208                // Some one was waiting for us, enter
     
    222222
    223223                // Park current thread waiting
    224                 park();
     224                park( __cfaabi_dbg_ctx );
    225225
    226226                /* paranoid */ verifyf( kernelTLS.this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, this->owner, this->recursion, this );
     
    264264        //We need to wake-up the thread
    265265        /* paranoid */ verifyf( !new_owner || new_owner == this->owner, "Expected owner to be %p, got %p (m: %p)", new_owner, this->owner, this );
    266         unpark( new_owner );
     266        unpark( new_owner __cfaabi_dbg_ctx2 );
    267267}
    268268
     
    493493        // Wake the threads
    494494        for(int i = 0; i < thread_count; i++) {
    495                 unpark( threads[i] );
     495                unpark( threads[i] __cfaabi_dbg_ctx2 );
    496496        }
    497497
    498498        // Everything is ready to go to sleep
    499         park();
     499        park( __cfaabi_dbg_ctx );
    500500
    501501        // We are back, restore the owners and recursions
     
    575575
    576576        // unpark the thread we signalled
    577         unpark( signallee );
     577        unpark( signallee __cfaabi_dbg_ctx2 );
    578578
    579579        //Everything is ready to go to sleep
    580         park();
     580        park( __cfaabi_dbg_ctx );
    581581
    582582
     
    679679
    680680                                // unpark the thread we signalled
    681                                 unpark( next );
     681                                unpark( next __cfaabi_dbg_ctx2 );
    682682
    683683                                //Everything is ready to go to sleep
    684                                 park();
     684                                park( __cfaabi_dbg_ctx );
    685685
    686686                                // We are back, restore the owners and recursions
     
    724724
    725725        //Everything is ready to go to sleep
    726         park();
     726        park( __cfaabi_dbg_ctx );
    727727
    728728
  • libcfa/src/concurrency/mutex.cfa

    rdd53f75 r17b6fc9  
    4242                append( blocked_threads, kernelTLS.this_thread );
    4343                unlock( lock );
    44                 park();
     44                park( __cfaabi_dbg_ctx );
    4545        }
    4646        else {
     
    6565        this.is_locked = (this.blocked_threads != 0);
    6666        unpark(
    67                 pop_head( this.blocked_threads )
     67                pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2
    6868        );
    6969        unlock( this.lock );
     
    9797                append( blocked_threads, kernelTLS.this_thread );
    9898                unlock( lock );
    99                 park();
     99                park( __cfaabi_dbg_ctx );
    100100        }
    101101}
     
    124124                owner = thrd;
    125125                recursion_count = (thrd ? 1 : 0);
    126                 unpark( thrd );
     126                unpark( thrd __cfaabi_dbg_ctx2 );
    127127        }
    128128        unlock( lock );
     
    142142        lock( lock __cfaabi_dbg_ctx2 );
    143143        unpark(
    144                 pop_head( this.blocked_threads )
     144                pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2
    145145        );
    146146        unlock( lock );
     
    151151        while(this.blocked_threads) {
    152152                unpark(
    153                         pop_head( this.blocked_threads )
     153                        pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2
    154154                );
    155155        }
     
    161161        append( this.blocked_threads, kernelTLS.this_thread );
    162162        unlock( this.lock );
    163         park();
     163        park( __cfaabi_dbg_ctx );
    164164}
    165165
     
    170170        unlock(l);
    171171        unlock(this.lock);
    172         park();
     172        park( __cfaabi_dbg_ctx );
    173173        lock(l);
    174174}
  • libcfa/src/concurrency/preemption.cfa

    rdd53f75 r17b6fc9  
    274274                kernelTLS.this_stats = this->curr_cluster->stats;
    275275        #endif
    276         __unpark( id, this );
     276        __unpark( id, this __cfaabi_dbg_ctx2 );
    277277}
    278278
  • libcfa/src/concurrency/thread.cfa

    rdd53f75 r17b6fc9  
    3939        link.prev = 0p;
    4040        link.preferred = -1;
    41         #if defined( __CFA_WITH_VERIFY__ )
    42                 canary = 0x0D15EA5E0D15EA5E;
    43         #endif
    4441
    4542        node.next = 0p;
     
    5148
    5249void ^?{}($thread& this) with( this ) {
    53         #if defined( __CFA_WITH_VERIFY__ )
    54                 canary = 0xDEADDEADDEADDEAD;
    55         #endif
    5650        unregister(curr_cluster, this);
    5751        ^self_cor{};
  • libcfa/src/concurrency/thread.hfa

    rdd53f75 r17b6fc9  
    8888//----------
    8989// Park thread: block until corresponding call to unpark, won't block if unpark is already called
    90 void park( void );
     90void park( __cfaabi_dbg_ctx_param );
    9191
    9292//----------
    9393// Unpark a thread, if the thread is already blocked, schedule it
    9494//                  if the thread is not yet block, signal that it should rerun immediately
    95 void unpark( $thread * this );
     95void unpark( $thread * this __cfaabi_dbg_ctx_param2 );
    9696
    9797forall( dtype T | is_thread(T) )
    98 static inline void unpark( T & this ) { if(!&this) return; unpark( get_thread( this ) );}
     98static inline void unpark( T & this __cfaabi_dbg_ctx_param2 ) { if(!&this) return; unpark( get_thread( this ) __cfaabi_dbg_ctx_fwd2 );}
    9999
    100100//----------
  • tests/concurrent/park/contention.cfa

    rdd53f75 r17b6fc9  
    2121                if(blocked[idx]) {
    2222                        Thread * thrd = __atomic_exchange_n(&blocked[idx], 0p, __ATOMIC_SEQ_CST);
    23                         unpark( *thrd );
     23                        unpark( *thrd __cfaabi_dbg_ctx2 );
    2424                } else {
    2525                        Thread * thrd = __atomic_exchange_n(&blocked[idx], &this, __ATOMIC_SEQ_CST);
    26                         unpark( *thrd );
    27                         park();
     26                        unpark( *thrd __cfaabi_dbg_ctx2 );
     27                        park( __cfaabi_dbg_ctx );
    2828                }
    2929        }
     
    4141                        int idx = myrand() % blocked_size;
    4242                        Thread * thrd = __atomic_exchange_n(&blocked[idx], 0p, __ATOMIC_SEQ_CST);
    43                         unpark( *thrd );
     43                        unpark( *thrd __cfaabi_dbg_ctx2 );
    4444                        yield( myrand() % 20 );
    4545                }
  • tests/concurrent/park/force_preempt.cfa

    rdd53f75 r17b6fc9  
    3030
    3131                // Unpark this thread, don't force a yield
    32                 unpark( this );
     32                unpark( this __cfaabi_dbg_ctx2 );
    3333                assert(mask == 0xCAFEBABA);
    3434
     
    4343                // Park this thread,
    4444                assert(mask == (id_hash ^ 0xCAFEBABA));
    45                 park();
     45                park( __cfaabi_dbg_ctx );
    4646                assert(mask == (id_hash ^ 0xCAFEBABA));
    4747
  • tests/concurrent/park/start_parked.cfa

    rdd53f75 r17b6fc9  
    33thread Parker {};
    44void main( Parker & ) {
    5         park();
     5        park( __cfaabi_dbg_ctx );
    66}
    77
     
    99        for(1000) {
    1010                Parker parker;
    11                 unpark( parker );
     11                unpark( parker __cfaabi_dbg_ctx2 );
    1212        }
    1313        printf( "done\n" );                                                                     // non-empty .expect file
Note: See TracChangeset for help on using the changeset viewer.