source: libcfa/src/concurrency/alarm.hfa @ ac2b598

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since ac2b598 was ac2b598, checked in by Thierry Delisle <tdelisle@…>, 22 months ago

Changed descriptors for concurrency to use $ prefix instead of trailing _desc

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[6cff9f3]1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
[73abe95]7// alarm.hfa --
[6cff9f3]8//
9// Author           : Thierry Delisle
10// Created On       : Fri Jun 2 11:31:25 2017
[91c389a]11// Last Modified By : Peter A. Buhr
[2a84d06d]12// Last Modified On : Mon Mar 26 16:25:41 2018
13// Update Count     : 11
[6cff9f3]14//
15
[6b0b624]16#pragma once
[6cff9f3]17
[c81ebf9]18#include <stdbool.h>
[8cb529e]19#include <stdint.h>
[c81ebf9]20
[91c389a]21#include <assert.h>
[6cff9f3]22
[58b6d1b]23#include "time.hfa"
[b69ea6b]24
[ac2b598]25struct $thread;
[6cff9f3]26struct processor;
27
[969b3fe]28//=============================================================================================
29// Clock logic
30//=============================================================================================
[c81ebf9]31
[2a84d06d]32Time __kernel_get_time();
33void __kernel_set_timer( Duration alarm );
[c81ebf9]34
35//=============================================================================================
36// Alarm logic
37//=============================================================================================
38
[6cff9f3]39struct alarm_node_t {
[2a84d06d]40        Time alarm;                             // time when alarm goes off
41        Duration period;                        // if > 0 => period of alarm
[c81ebf9]42        alarm_node_t * next;            // intrusive link list field
[6cff9f3]43
44        union {
[ac2b598]45                $thread * thrd; // thrd who created event
[6cff9f3]46                processor * proc;               // proc who created event
47        };
[c81ebf9]48
49        bool set                :1;             // whether or not the alarm has be registered
50        bool kernel_alarm       :1;             // true if this is not a user defined alarm
[6cff9f3]51};
52
53typedef alarm_node_t ** __alarm_it_t;
54
[ac2b598]55void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period );
[2a84d06d]56void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
[242a902]57void ^?{}( alarm_node_t & this );
[6cff9f3]58
59struct alarm_list_t {
60        alarm_node_t * head;
61        __alarm_it_t tail;
62};
63
[c40e7c5]64static inline void ?{}( alarm_list_t & this ) with( this ) {
65        head = 0;
66        tail = &head;
[6cff9f3]67}
68
69void insert( alarm_list_t * this, alarm_node_t * n );
70alarm_node_t * pop( alarm_list_t * this );
71
[c81ebf9]72void register_self  ( alarm_node_t * this );
73void unregister_self( alarm_node_t * this );
74
[6cff9f3]75// Local Variables: //
[6b0b624]76// mode: c //
[6cff9f3]77// tab-width: 6 //
[242a902]78// End: //
Note: See TracBrowser for help on using the repository browser.