source: src/libcfa/concurrency/kernel @ 26ba208

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 26ba208 was 348006f, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Renamed thread to thread_desc

  • Property mode set to 100644
File size: 1.8 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
30void lock( spinlock * );
31void unlock( spinlock * );
32
33void wait( signal_once * );
34void signal( signal_once * );
35
36//-----------------------------------------------------------------------------
37// Cluster
38struct cluster {
39        simple_thread_list ready_queue;
40        spinlock lock;
41};
42
43void ?{}(cluster * this);
44void ^?{}(cluster * this);
45
46//-----------------------------------------------------------------------------
47// Processor
48enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule };
49struct FinishAction {
50        FinishOpCode action_code;
51        thread_desc * thrd;
52        spinlock * lock;
53};
54static inline void ?{}(FinishAction * this) {
55        this->action_code = No_Action;
56        this->thrd = NULL;
57        this->lock = NULL;
58}
59static inline void ^?{}(FinishAction * this) {}
60
61struct processor {
62        struct processorCtx_t * runner;
63        cluster * cltr;
64        coroutine_desc * current_coroutine;
65        thread_desc * current_thread;
66        pthread_t kernel_thread;
67       
68        signal_once terminated;
69        volatile bool is_terminated;
70
71        struct FinishAction finish;
72};
73
74void ?{}(processor * this);
75void ?{}(processor * this, cluster * cltr);
76void ^?{}(processor * this);
77
78#endif //KERNEL_H
79
80// Local Variables: //
81// mode: c //
82// tab-width: 4 //
83// End: //
Note: See TracBrowser for help on using the repository browser.