Changes in / [55da258:4011b98]


Ignore:
Location:
libcfa/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/containers.hfa

    r55da258 r4011b98  
    1717#include "bits/align.hfa"
    1818#include "bits/defs.hfa"
    19 #include <stdio.h>
     19
    2020//-----------------------------------------------------------------------------
    2121// Array
     
    146146        static inline forall( dtype T | is_node(T) ) {
    147147                void ?{}( __queue(T) & this ) with( this ) {
    148                         (this.head){ 1p };
    149                         (this.tail){ &this.head };
    150                         verify(*this.tail == 1p);
     148                        head{ 1p };
     149                        tail{ &head };
     150                        verify(*tail == 1p);
    151151                }
    152152
    153153                void append( __queue(T) & this, T * val ) with( this ) {
    154                         verify(this.tail != 0p);
    155                         verify(*this.tail == 1p);
    156                         *this.tail = val;
    157                         this.tail = &get_next( *val );
    158                         *this.tail = 1p;
     154                        verify(tail != 0p);
     155                        verify(*tail == 1p);
     156                        *tail = val;
     157                        tail = &get_next( *val );
     158                        *tail = 1p;
    159159                }
    160160
    161161                T * peek( __queue(T) & this ) {
    162162                        verify(*this.tail == 1p);
    163                         T * front = this.head;
    164                         if( front != 1p ) {
     163                        T * head = this.head;
     164                        if( head != 1p ) {
    165165                                verify(*this.tail == 1p);
    166                                 return front;
     166                                return head;
    167167                        }
    168168                        verify(*this.tail == 1p);
     
    172172                T * pop_head( __queue(T) & this ) {
    173173                        verify(*this.tail == 1p);
    174                         T * _head = this.head;
    175                         if( _head != 1p ) {
    176                                 this.head = get_next( *_head );
    177                                 if( get_next( *_head ) == 1p ) {
     174                        T * head = this.head;
     175                        if( head != 1p ) {
     176                                this.head = get_next( *head );
     177                                if( get_next( *head ) == 1p ) {
    178178                                        this.tail = &this.head;
    179179                                }
    180                                 get_next( *_head ) = 0p;
     180                                get_next( *head ) = 0p;
    181181                                verify(*this.tail == 1p);
    182                                 verify( get_next(*_head) == 0p );
    183                                 return _head;
     182                                verify( get_next(*head) == 0p );
     183                                return head;
    184184                        }
    185185                        verify(*this.tail == 1p);
     
    193193                        (*it) = get_next( *val );
    194194
    195                         if( this.tail == &get_next( *val ) ) {
    196                                 this.tail = it;
     195                        if( tail == &get_next( *val ) ) {
     196                                tail = it;
    197197                        }
    198198
    199199                        get_next( *val ) = 0p;
    200200
    201                         verify( (this.head == 1p) == (&this.head == this.tail) );
    202                         verify( *this.tail == 1p );
     201                        verify( (head == 1p) == (&head == tail) );
     202                        verify( *tail == 1p );
    203203                        return val;
    204204                }
     
    239239        forall(dtype T )
    240240        static inline [void] ?{}( __dllist(T) & this, * [T * & next, T * & prev] ( T & ) __get ) {
    241                 (this.head){ 0p };
     241                this.head{ 0p };
    242242                this.__get = __get;
    243243        }
     
    248248                void push_front( __dllist(T) & this, T & node ) with( this ) {
    249249                        verify(__get);
    250                         if ( this.head ) {
    251                                 __get( node ).next = this.head;
    252                                 __get( node ).prev = __get( *this.head ).prev;
     250                        if ( head ) {
     251                                __get( node ).next = head;
     252                                __get( node ).prev = __get( *head ).prev;
    253253                                // inserted node must be consistent before it is seen
    254254                                // prevent code movement across barrier
    255255                                asm( "" : : : "memory" );
    256                                 __get( *this.head ).prev = &node;
     256                                __get( *head ).prev = &node;
    257257                                T & _prev = *__get( node ).prev;
    258258                                __get( _prev ).next = &node;
     
    264264                        // prevent code movement across barrier
    265265                        asm( "" : : : "memory" );
    266                         this.head = &node;
     266                        head = &node;
    267267                }
    268268
    269269                void remove( __dllist(T) & this, T & node ) with( this ) {
    270270                        verify(__get);
    271                         if ( &node == this.head ) {
    272                                 if ( __get( *this.head ).next == this.head ) {
    273                                         this.head = 0p;
     271                        if ( &node == head ) {
     272                                if ( __get( *head ).next == head ) {
     273                                        head = 0p;
    274274                                } else {
    275                                         this.head = __get( *this.head ).next;
     275                                        head = __get( *head ).next;
    276276                                }
    277277                        }
  • libcfa/src/concurrency/alarm.cfa

    r55da258 r4011b98  
    6060        type = Kernel;
    6161}
    62 void ?{}( alarm_node_t & this, Alarm_Callback callback, Time alarm, Duration period ) with( this ) {
     62void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback ) with( this ) {
     63        this.thrd = thrd;
    6364        this.alarm = alarm;
    6465        this.period = period;
  • libcfa/src/concurrency/alarm.hfa

    r55da258 r4011b98  
    5252
    5353        union {
    54                 $thread * thrd;                                 // thrd who created event
    55                 processor * proc;                               // proc who created event
    56                 Alarm_Callback callback;                // callback to handle event
     54                $thread * thrd; // thrd who created event
     55                processor * proc;               // proc who created event
    5756        };
     57
     58        Alarm_Callback callback;
    5859
    5960        bool set                :1;             // whether or not the alarm has be registered
     
    6465void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period );
    6566void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
    66 void ?{}( alarm_node_t & this, Alarm_Callback callback, Time alarm, Duration period );
     67void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback );
    6768void ^?{}( alarm_node_t & this );
    6869
  • libcfa/src/concurrency/locks.cfa

    r55da258 r4011b98  
    207207        void ^?{}( condition_variable(L) & this ){ }
    208208
    209         void ?{}( alarm_node_wrap(L) & this, Time alarm, Duration period, Alarm_Callback callback ) {
    210                 this.alarm_node{ callback, alarm, period };
     209        void ?{}( alarm_node_wrap(L) & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback ) {
     210                this.alarm_node{ thrd, alarm, period, callback };
    211211        }
    212212
     
    277277                lock( lock __cfaabi_dbg_ctx2 );
    278278                size_t recursion_count = queue_and_get_recursion(this, &info);
    279                 alarm_node_wrap(L) node_wrap = { t, 0`s, alarm_node_wrap_cast };
     279                alarm_node_wrap(L) node_wrap = { info.t, t, 0`s, alarm_node_wrap_cast };
    280280                node_wrap.cond = &this;
    281281                node_wrap.i = &info;
  • libcfa/src/concurrency/locks.hfa

    r55da258 r4011b98  
    164164        };
    165165
    166         void ?{}( alarm_node_wrap(L) & this, Time alarm, Duration period, Alarm_Callback callback );
     166        void ?{}( alarm_node_wrap(L) & this, $thread * thrd, Time alarm, Duration period, Alarm_Callback callback );
    167167        void ^?{}( alarm_node_wrap(L) & this );
    168168
Note: See TracChangeset for help on using the changeset viewer.