source: src/tests/sched-int-multi.c @ 13e2c54

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

Internal scheduling tests

  • Property mode set to 100644
File size: 977 bytes
RevLine 
[f80ab45]1#include <fstream>
2#include <kernel>
3#include <monitor>
4#include <thread>
5
6monitor global_t {};
7
8global_t globalB;
9global_t globalA;
10
11condition cond;
12
13thread Signalee {};
14thread Signaler {};
15
16void signalee_action( global_t * mutex a, global_t * mutex b ) {
17        sout | "Waiting All" | endl;
18        wait( &cond );
19        sout | "Done waiting" | endl;
20}
21
22void main( Signalee* this ) {
23        signalee_action( &globalA, &globalB );
24}
25
26void signaler_action_inner( global_t * mutex a, global_t * mutex b ) {
27        sout | "Entering A & B" | endl;
28        sout | "Signal" | endl;
29        signal( &cond );
30        sout | "Leaving  A & B" | endl;
31}
32
33void signaler_action( global_t * mutex a, global_t * b ) {
34        sout | "Entering A" | endl;
35        signaler_action_inner( a, b );
36        sout | "Leaving  A" | endl;
37}
38
39void main( Signaler* this ) {
40        for(int i = 0; i < 10_000; i++) {
41                asm volatile ("" : : : "memory");
42        }
43
44        signaler_action( &globalA, &globalB );
45}
46
47int main(int argc, char* argv[]) {
48        processor p;
49        {
50                Signalee a;
51                Signaler b;
52        }
53}
Note: See TracBrowser for help on using the repository browser.