Changeset eafb094


Ignore:
Timestamp:
Feb 13, 2017, 5:20:06 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
294647b, d3a804f5
Parents:
ee897e4b
Message:

Removed global spinlock

Location:
src/libcfa/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel

    ree897e4b reafb094  
    2828//-----------------------------------------------------------------------------
    2929// Locks
    30 // void lock( simple_lock * );
    31 // void lock( simple_lock *, spinlock * );
    32 // void unlock( simple_lock * );
    33 
    3430void lock( spinlock * );
    3531void unlock( spinlock * );
  • src/libcfa/concurrency/kernel.c

    ree897e4b reafb094  
    3636#include "invoke.h"
    3737
    38 static volatile int lock;
    39 
    40 void spin_lock( volatile int *lock ) {
    41         for ( unsigned int i = 1;; i += 1 ) {
    42           if ( *lock == 0 && __sync_lock_test_and_set_4( lock, 1 ) == 0 ) break;
    43         }
    44 }
    45 
    46 void spin_unlock( volatile int *lock ) {
    47         __sync_lock_release_4( lock );
    48 }
    49 
    5038//-----------------------------------------------------------------------------
    5139// Kernel storage
     
    176164void ?{}(cluster * this) {
    177165        ( &this->ready_queue ){};
    178         lock = 0;
     166        ( &this->lock ){};
    179167}
    180168
     
    413401//-----------------------------------------------------------------------------
    414402// Locks
    415 // void ?{}( simple_lock * this ) {
    416 //      ( &this->blocked ){};
    417 // }
    418 
    419 // void ^?{}( simple_lock * this ) {
    420 
    421 // }
    422 
    423 // void lock( simple_lock * this ) {
    424 //      {
    425 //              spin_lock( &lock );
    426 //              append( &this->blocked, this_thread() );
    427 //              spin_unlock( &lock );
    428 //      }
    429 //      ScheduleInternal();
    430 // }
    431 
    432 // void lock( simple_lock * this, spinlock * to_release ) {
    433 //      {
    434 //              spin_lock( &lock );
    435 //              append( &this->blocked, this_thread() );
    436 //              spin_unlock( &lock );
    437 //      }
    438 //      ScheduleInternal( to_release );
    439 //      lock( to_release );
    440 // }
    441 
    442 // void unlock( simple_lock * this ) {
    443 //      thread * it;
    444 //      while( it = pop_head( &this->blocked) ) {
    445 //              ScheduleThread( it );
    446 //      }
    447 // }
    448 
    449403void ?{}( spinlock * this ) {
    450404        this->lock = 0;
Note: See TracChangeset for help on using the changeset viewer.