Ignore:
Timestamp:
May 4, 2020, 8:59:09 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
08a994e, f90d10f
Parents:
4d741e9
Message:

Using dlist in alarm.

Minimal interface changes in alarm.hfa applied; some spill to preemption.cfa occured.

List management logic removed, including such helper functions from alarm.cfa. Remaining logic is concurrency-protection wrapping, and picking insertion point by traversing and comparing alarm-fire times.

Integrity checking definitions removed here. Calling version brought into list.hfa by change 4d741 instead.

File:
1 edited

Legend:

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

    r4d741e9 rd3ab183  
    8484// Get next expired node
    8585static inline alarm_node_t * get_expired( alarm_list_t * alarms, Time currtime ) {
    86         if( !alarms->head ) return 0p;                                          // If no alarms return null
    87         if( alarms->head->alarm >= currtime ) return 0p;        // If alarms head not expired return null
     86        if( ! & (*alarms)`first ) return 0p;                                            // If no alarms return null
     87        if( (*alarms)`first.alarm >= currtime ) return 0p;      // If alarms head not expired return null
    8888        return pop(alarms);                                                                     // Otherwise just pop head
    8989}
     
    120120
    121121        // If there are still alarms pending, reset the timer
    122         if( alarms->head ) {
     122        if( & (*alarms)`first ) {
    123123                __cfaabi_dbg_print_buffer_decl( " KERNEL: @%ju(%ju) resetting alarm to %ju.\n", currtime.tv, __kernel_get_time().tv, (alarms->head->alarm - currtime).tv);
    124                 Duration delta = alarms->head->alarm - currtime;
    125                 Duration caped = max(delta, 50`us);
     124                Duration delta = (*alarms)`first.alarm - currtime;
     125                Duration capped = max(delta, 50`us);
    126126                // itimerval tim  = { caped };
    127127                // __cfaabi_dbg_print_buffer_local( "    Values are %lu, %lu, %lu %lu.\n", delta.tv, caped.tv, tim.it_value.tv_sec, tim.it_value.tv_usec);
    128128
    129                 __kernel_set_timer( caped );
     129                __kernel_set_timer( capped );
    130130        }
    131131}
Note: See TracChangeset for help on using the changeset viewer.