Ignore:
Timestamp:
Jun 19, 2020, 3:49:43 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
68f36f4
Parents:
04b5cef
Message:

Fixed idle sleep to no-longer use a spinlock, broke registration and gdbtools in the process

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/ready_queue.cfa

    r04b5cef r64a7146  
    8181        this.handle = proc;
    8282        this.lock   = false;
     83        #ifdef __CFA_WITH_VERIFY__
     84                this.owned  = false;
     85        #endif
    8386}
    8487
     
    97100                        && __atomic_compare_exchange_n( &data[i].handle, &null, proc, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    98101                        /*paranoid*/ verify(i < ready);
    99                         /*paranoid*/ verify(__alignof__(data[i]) == cache_line_size);
     102                        /*paranoid*/ verify(0 == (__alignof__(data[i]) % cache_line_size));
    100103                        /*paranoid*/ verify((((uintptr_t)&data[i]) % cache_line_size) == 0);
    101104                        return i;
     
    562565
    563566//-----------------------------------------------------------------------
     567__attribute__((hot)) bool query(struct cluster * cltr) {
     568        return query(cltr->ready_queue.snzi);
     569}
     570
     571//-----------------------------------------------------------------------
    564572__attribute__((hot)) bool push(struct cluster * cltr, struct $thread * thrd) with (cltr->ready_queue) {
    565573        __cfadbg_print_safe(ready_queue, "Kernel : Pushing %p on cluster %p\n", thrd, cltr);
     
    761769// Grow the ready queue
    762770void ready_queue_grow  (struct cluster * cltr) {
    763         // Lock the RWlock so no-one pushes/pops while we are changing the queue
    764         uint_fast32_t last_size = ready_mutate_lock();
    765 
     771        /* paranoid */ verify( ready_mutate_islocked() );
    766772        __cfadbg_print_safe(ready_queue, "Kernel : Growing ready queue\n");
    767773
     
    808814        __cfadbg_print_safe(ready_queue, "Kernel : Growing ready queue done\n");
    809815
    810         // Unlock the RWlock
    811         ready_mutate_unlock( last_size );
     816        /* paranoid */ verify( ready_mutate_islocked() );
    812817}
    813818
    814819// Shrink the ready queue
    815820void ready_queue_shrink(struct cluster * cltr) {
    816         // Lock the RWlock so no-one pushes/pops while we are changing the queue
    817         uint_fast32_t last_size = ready_mutate_lock();
    818 
     821        /* paranoid */ verify( ready_mutate_islocked() );
    819822        __cfadbg_print_safe(ready_queue, "Kernel : Shrinking ready queue\n");
    820823
     
    889892
    890893        __cfadbg_print_safe(ready_queue, "Kernel : Shrinking ready queue done\n");
    891 
    892         // Unlock the RWlock
    893         ready_mutate_unlock( last_size );
    894 }
     894        /* paranoid */ verify( ready_mutate_islocked() );
     895}
Note: See TracChangeset for help on using the changeset viewer.