source: src/libcfa/concurrency/kernel_private.h@ 9d85038

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 9d85038 was 82ff5845, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

First implementation of preemption, does not appear to work with scheduling

  • Property mode set to 100644
File size: 2.0 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 "kernel"
21#include "thread"
22
23#include "alarm.h"
24
25//-----------------------------------------------------------------------------
26// Scheduler
27void ScheduleThread( thread_desc * );
28thread_desc * nextThread(cluster * this);
29
30void BlockInternal(void);
31void BlockInternal(spinlock * lock);
32void BlockInternal(thread_desc * thrd);
33void BlockInternal(spinlock * lock, thread_desc * thrd);
34void BlockInternal(spinlock ** locks, unsigned short count);
35void BlockInternal(spinlock ** locks, unsigned short count, thread_desc ** thrds, unsigned short thrd_count);
36
37//-----------------------------------------------------------------------------
38// Processor
39coroutine processorCtx_t {
40 processor * proc;
41};
42
43void main(processorCtx_t *);
44void start(processor * this);
45void runThread(processor * this, thread_desc * dst);
46void finishRunning(processor * this);
47void spin(processor * this, unsigned int * spin_count);
48
49struct system_proc_t {
50 processor proc;
51
52 alarm_list_t alarms;
53 spinlock alarm_lock;
54
55 bool pending_alarm;
56};
57
58extern cluster * systemCluster;
59extern system_proc_t * systemProcessor;
60extern thread_local processor * this_processor;
61
62extern "C" {
63 void disable_interrupts();
64 void enable_interrupts_noRF();
65 void enable_interrupts();
66}
67
68//-----------------------------------------------------------------------------
69// Threads
70extern "C" {
71 forall(dtype T | is_thread(T))
72 void CtxInvokeThread(T * this);
73}
74
75extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
76
77#endif //KERNEL_PRIVATE_H
78
79// Local Variables: //
80// mode: c //
81// tab-width: 4 //
82// End: //
Note: See TracBrowser for help on using the repository browser.