source: src/libcfa/concurrency/kernel_private.h @ f2b12406

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 f2b12406 was f2b12406, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Preemption is now stable enough to push, some clean-up needed

  • Property mode set to 100644
File size: 2.5 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_private.h --
9//
10// Author           : Thierry Delisle
11// Created On       : Mon Feb 13 12:27:26 2017
12// Last Modified By : Thierry Delisle
13// Last Modified On : --
14// Update Count     : 0
15//
16
17#ifndef KERNEL_PRIVATE_H
18#define KERNEL_PRIVATE_H
19
20#include "libhdr.h"
21
22#include "kernel"
23#include "thread"
24
25#include "alarm.h"
26
27
28//-----------------------------------------------------------------------------
29// Scheduler
30
31extern "C" {
32        void disable_interrupts();
33        void enable_interrupts_noRF();
34        void enable_interrupts( DEBUG_CTX_PARAM );
35}
36
37void ScheduleThread( thread_desc * );
38static inline void WakeThread( thread_desc * thrd ) {
39        if( !thrd ) return;
40
41        disable_interrupts();
42        ScheduleThread( thrd );
43        enable_interrupts( DEBUG_CTX );
44}
45thread_desc * nextThread(cluster * this);
46
47void BlockInternal(void);
48void BlockInternal(spinlock * lock);
49void BlockInternal(thread_desc * thrd);
50void BlockInternal(spinlock * lock, thread_desc * thrd);
51void BlockInternal(spinlock ** locks, unsigned short count);
52void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
53void LeaveThread(spinlock * lock, thread_desc * thrd);
54
55//-----------------------------------------------------------------------------
56// Processor
57coroutine processorCtx_t {
58        processor * proc;
59};
60
61void main(processorCtx_t *);
62void start(processor * this);
63void runThread(processor * this, thread_desc * dst);
64void finishRunning(processor * this);
65void spin(processor * this, unsigned int * spin_count);
66
67struct system_proc_t {
68        processor proc;
69
70        alarm_list_t alarms;
71        spinlock alarm_lock;
72
73        bool pending_alarm;
74};
75
76extern cluster * systemCluster;
77extern system_proc_t * systemProcessor;
78extern volatile thread_local processor * this_processor;
79extern volatile thread_local coroutine_desc * this_coroutine;
80extern volatile thread_local thread_desc * this_thread;
81extern volatile thread_local unsigned short disable_preempt_count;
82
83//-----------------------------------------------------------------------------
84// Threads
85extern "C" {
86      forall(dtype T | is_thread(T))
87      void CtxInvokeThread(T * this);
88}
89
90extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
91
92#endif //KERNEL_PRIVATE_H
93
94// Local Variables: //
95// mode: c //
96// tab-width: 4 //
97// End: //
Note: See TracBrowser for help on using the repository browser.