source: src/libcfa/concurrency/kernel@ 6152c81

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

Removed global spinlock

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[8118303]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// threads --
9//
10// Author : Thierry Delisle
[75f3522]11// Created On : Tue Jan 17 12:27:26 2017
[8118303]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
[c84e80a]20#include <stdbool.h>
[8118303]21
[bd98b58]22#include "invoke.h"
23
[8def349]24extern "C" {
25#include <pthread.h>
26}
27
[db6f06a]28//-----------------------------------------------------------------------------
29// Locks
30void lock( spinlock * );
31void unlock( spinlock * );
32
33void wait( signal_once * );
34void signal( signal_once * );
35
[bd98b58]36//-----------------------------------------------------------------------------
37// Cluster
38struct cluster {
39 simple_thread_list ready_queue;
[db6f06a]40 spinlock lock;
[bd98b58]41};
42
43void ?{}(cluster * this);
44void ^?{}(cluster * this);
45
46//-----------------------------------------------------------------------------
47// Processor
[db6f06a]48enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule };
49struct FinishAction {
50 FinishOpCode action_code;
51 thread * thrd;
52 spinlock * lock;
[8fcbb4c]53};
[db6f06a]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) {}
[8fcbb4c]60
[c84e80a]61struct processor {
[8fcbb4c]62 struct processorCtx_t * runner;
[bd98b58]63 cluster * cltr;
64 coroutine * current_coroutine;
[e15df4c]65 thread * current_thread;
[8def349]66 pthread_t kernel_thread;
[db6f06a]67
68 signal_once terminated;
69 volatile bool is_terminated;
70
71 struct FinishAction finish;
[c84e80a]72};
73
[8def349]74void ?{}(processor * this);
[bd98b58]75void ?{}(processor * this, cluster * cltr);
[c84e80a]76void ^?{}(processor * this);
77
[8118303]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.