source: src/libcfa/concurrency/kernel @ 2ac095d

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 2ac095d was 2ac095d, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Added macros for parameters only present in debug

  • Property mode set to 100644
File size: 2.3 KB
Line 
1//                              -*- Mode: CFA -*-
2//
3// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
4//
5// The contents of this file are covered under the licence agreement in the
6// file "LICENCE" distributed with Cforall.
7//
8// kernel --
9//
10// Author           : Thierry Delisle
11// Created On       : Tue Jan 17 12:27:26 2017
12// Last Modified By : Thierry Delisle
13// Last Modified On : --
14// Update Count     : 0
15//
16
17#ifndef KERNEL_H
18#define KERNEL_H
19
20#include <stdbool.h>
21
22#include "invoke.h"
23
24extern "C" {
25#include <pthread.h>
26}
27
28//-----------------------------------------------------------------------------
29// Locks
30bool try_lock( spinlock * DEBUG_CTX_PARAM2 );
31void lock    ( spinlock * DEBUG_CTX_PARAM2 );
32void unlock  ( spinlock * );
33
34struct signal_once {
35        volatile bool cond;
36        struct spinlock lock;
37        struct __thread_queue_t blocked;
38};
39
40void ?{}(signal_once * this);
41void ^?{}(signal_once * this);
42
43void wait( signal_once * );
44void signal( signal_once * );
45
46//-----------------------------------------------------------------------------
47// Cluster
48struct cluster {
49        __thread_queue_t ready_queue;
50        spinlock lock;
51};
52
53void ?{}(cluster * this);
54void ^?{}(cluster * this);
55
56//-----------------------------------------------------------------------------
57// Processor
58enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule, Release_Multi, Release_Multi_Schedule };
59
60//TODO use union, many of these fields are mutually exclusive (i.e. MULTI vs NOMULTI)
61struct FinishAction {
62        FinishOpCode action_code;
63        thread_desc * thrd;
64        spinlock * lock;
65        spinlock ** locks;
66        unsigned short lock_count;
67        thread_desc ** thrds;
68        unsigned short thrd_count;
69};
70static inline void ?{}(FinishAction * this) {
71        this->action_code = No_Action;
72        this->thrd = NULL;
73        this->lock = NULL;
74}
75static inline void ^?{}(FinishAction * this) {}
76
77struct processor {
78        struct processorCtx_t * runner;
79        cluster * cltr;
80        pthread_t kernel_thread;
81
82        signal_once terminated;
83        volatile bool is_terminated;
84
85        struct FinishAction finish;
86
87        struct alarm_node_t * preemption_alarm;
88        unsigned int preemption;
89
90        bool pending_preemption;
91
92        char * last_enable;
93};
94
95void ?{}(processor * this);
96void ?{}(processor * this, cluster * cltr);
97void ^?{}(processor * this);
98
99#endif //KERNEL_H
100
101// Local Variables: //
102// mode: CFA //
103// tab-width: 6 //
104// End: //
Note: See TracBrowser for help on using the repository browser.