source: libcfa/src/concurrency/alarm.hfa @ 2b5be17

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 2b5be17 was 1eb239e4, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Removed snzi and replaced it with a fast/slow path

  • Property mode set to 100644
File size: 1.9 KB
Line 
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//
7// alarm.hfa --
8//
9// Author           : Thierry Delisle
10// Created On       : Fri Jun 2 11:31:25 2017
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Mon Mar 26 16:25:41 2018
13// Update Count     : 11
14//
15
16#pragma once
17
18#include <stdbool.h>
19#include <stdint.h>
20
21#include <assert.h>
22
23#include "time.hfa"
24
25#include "containers/list.hfa"
26
27struct $thread;
28struct processor;
29
30//=============================================================================================
31// Clock logic
32//=============================================================================================
33
34Time __kernel_get_time();
35void __kernel_set_timer( Duration alarm );
36
37//=============================================================================================
38// Alarm logic
39//=============================================================================================
40
41struct alarm_node_t {
42        Time alarm;                             // time when alarm goes off
43        Duration period;                        // if > 0 => period of alarm
44
45        DLISTED_MGD_IMPL_IN(alarm_node_t)
46
47        union {
48                $thread * thrd; // thrd who created event
49                processor * proc;               // proc who created event
50        };
51
52        bool set                :1;             // whether or not the alarm has be registered
53        bool kernel_alarm       :1;             // true if this is not a user defined alarm
54};
55DLISTED_MGD_IMPL_OUT(alarm_node_t)
56
57void ?{}( alarm_node_t & this, $thread * thrd, Time alarm, Duration period );
58void ?{}( alarm_node_t & this, processor   * proc, Time alarm, Duration period );
59void ^?{}( alarm_node_t & this );
60
61typedef dlist(alarm_node_t, alarm_node_t) alarm_list_t;
62
63void insert( alarm_list_t * this, alarm_node_t * n );
64alarm_node_t * pop( alarm_list_t * this );
65
66void register_self  ( alarm_node_t * this );
67void unregister_self( alarm_node_t * this );
68
69// Local Variables: //
70// mode: c //
71// tab-width: 6 //
72// End: //
Note: See TracBrowser for help on using the repository browser.