Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/monitor.c

    ra933dcf4 r9c59cd4  
    1717#include "monitor"
    1818
    19 #include <stdlib>
    20 
    2119#include "kernel_private.h"
    2220#include "libhdr.h"
     
    132130        this_thread()->current_monitors      = this->prev_mntrs;
    133131        this_thread()->current_monitor_count = this->prev_count;
    134 }
    135 
    136 void debug_break() __attribute__(( noinline ))
    137 {
    138        
    139132}
    140133
     
    178171
    179172        //Find the next thread(s) to run
    180         unsigned short thread_count = 0;
     173        unsigned short thread_count = count;
    181174        thread_desc * threads[ count ];
    182         for(int i = 0; i < count; i++) {
    183                 threads[i] = 0;
    184         }
    185 
    186         debug_break();
    187175
    188176        for( int i = 0; i < count; i++) {
    189177                thread_desc * new_owner = next_thread( this->monitors[i] );
    190                 thread_count = insert_unique( threads, thread_count, new_owner );
    191         }
    192 
    193         debug_break();
     178                thread_count = insert_unique( threads, i, new_owner );
     179        }
    194180
    195181        LIB_DEBUG_PRINT_SAFE("Will unblock: ");
     
    353339                LIB_DEBUG_PRINT_SAFE("Branding\n");
    354340                assertf( thrd->current_monitors != NULL, "No current monitor to brand condition", thrd->current_monitors );
     341                this->monitors = thrd->current_monitors;
    355342                this->monitor_count = thrd->current_monitor_count;
    356 
    357                 this->monitors = malloc( this->monitor_count * sizeof( *this->monitors ) );
    358                 for( int i = 0; i < this->monitor_count; i++ ) {
    359                         this->monitors[i] = thrd->current_monitors[i];
    360                 }
    361343        }
    362344}
    363345
    364346static inline unsigned short insert_unique( thread_desc ** thrds, unsigned short end, thread_desc * val ) {
    365         if( !val ) return end;
    366 
    367         for(int i = 0; i <= end; i++) {
     347        for(int i = 0; i < end; i++) {
    368348                if( thrds[i] == val ) return end;
    369349        }
Note: See TracChangeset for help on using the changeset viewer.