Ignore:
Timestamp:
Jul 26, 2017, 12:19:41 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
b947fb2
Parents:
e0a653d (diff), ea91c42 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/alarm.h

    re0a653d r33218c6  
    1 //                              -*- Mode: CFA -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    109// Author           : Thierry Delisle
    1110// Created On       : Fri Jun 2 11:31:25 2017
    12 // Last Modified By : Thierry Delisle
    13 // Last Modified On : --
    14 // Update Count     : 0
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:59:27 2017
     13// Update Count     : 3
    1514//
    1615
    17 #ifndef ALARM_H
    18 #define ALARM_H
     16#pragma once
    1917
    2018#include <stdbool.h>
     19#include <stdint.h>
    2120
    22 #include "assert"
    23 
    24 typedef unsigned long int __cfa_time_t;
     21#include <assert.h>
    2522
    2623struct thread_desc;
    2724struct processor;
    2825
     26struct timespec;
     27struct itimerval;
     28
     29//=============================================================================================
     30// time type
     31//=============================================================================================
     32
     33struct __cfa_time_t {
     34        uint64_t val;
     35};
     36
     37// ctors
     38void ?{}( __cfa_time_t * this );
     39void ?{}( __cfa_time_t * this, zero_t zero );
     40void ?{}( __cfa_time_t * this, timespec * curr );
     41void ?{}( itimerval * this, __cfa_time_t * alarm );
     42
     43__cfa_time_t ?=?( __cfa_time_t * this, zero_t rhs );
     44
     45// logical ops
     46static inline bool ?==?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val == rhs.val; }
     47static inline bool ?!=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val != rhs.val; }
     48static inline bool ?>? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >  rhs.val; }
     49static inline bool ?<? ( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <  rhs.val; }
     50static inline bool ?>=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val >= rhs.val; }
     51static inline bool ?<=?( __cfa_time_t lhs, __cfa_time_t rhs ) { return lhs.val <= rhs.val; }
     52
     53static inline bool ?==?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val == rhs; }
     54static inline bool ?!=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val != rhs; }
     55static inline bool ?>? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >  rhs; }
     56static inline bool ?<? ( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <  rhs; }
     57static inline bool ?>=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val >= rhs; }
     58static inline bool ?<=?( __cfa_time_t lhs, zero_t rhs ) { return lhs.val <= rhs; }
     59
     60// addition/substract
     61static inline __cfa_time_t ?+?( __cfa_time_t lhs, __cfa_time_t rhs ) {
     62        __cfa_time_t ret;
     63        ret.val = lhs.val + rhs.val;
     64        return ret;
     65}
     66
     67static inline __cfa_time_t ?-?( __cfa_time_t lhs, __cfa_time_t rhs ) {
     68        __cfa_time_t ret;
     69        ret.val = lhs.val - rhs.val;
     70        return ret;
     71}
     72
     73__cfa_time_t from_s ( uint64_t );
     74__cfa_time_t from_ms( uint64_t );
     75__cfa_time_t from_us( uint64_t );
     76__cfa_time_t from_ns( uint64_t );
     77
     78extern __cfa_time_t zero_time;
     79
    2980//=============================================================================================
    3081// Clock logic
    3182//=============================================================================================
    32 
    33 #define TIMEGRAN 1_000_000_000L                         // nanosecond granularity, except for timeval
    3483
    3584__cfa_time_t __kernel_get_time();
     
    56105typedef alarm_node_t ** __alarm_it_t;
    57106
    58 void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
    59 void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = 0, __cfa_time_t period = 0 );
     107void ?{}( alarm_node_t * this, thread_desc * thrd, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
     108void ?{}( alarm_node_t * this, processor   * proc, __cfa_time_t alarm = zero_time, __cfa_time_t period = zero_time );
    60109void ^?{}( alarm_node_t * this );
    61110
     
    76125void unregister_self( alarm_node_t * this );
    77126
    78 #endif
    79 
    80127// Local Variables: //
    81 // mode: CFA //
     128// mode: c //
    82129// tab-width: 6 //
    83130// End: //
Note: See TracChangeset for help on using the changeset viewer.