source: src/tests/preempt_longrun/processor.c@ f184ca3

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 with_gc
Last change on this file since f184ca3 was 85b1deb, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Fix processor halting

  • Property mode set to 100644
File size: 748 bytes
Line 
1#include <kernel>
2#include <thread>
3#include <time>
4
5#include <unistd.h>
6
7#ifndef PREEMPTION_RATE
8#error PREEMPTION_RATE not defined in makefile
9#endif
10
11Duration default_preemption() {
12 return PREEMPTION_RATE;
13}
14
15static const unsigned long N = 50_000ul;
16
17int main(int argc, char* argv[]) {
18 processor * p[15];
19 write(STDOUT_FILENO, "Preparing\n", sizeof("Preparing\n"));
20 for ( int pi = 0; pi < 15; pi++ ) {
21 p[pi] = new();
22 }
23 write(STDOUT_FILENO, "Starting\n", sizeof("Starting\n"));
24 for ( int i = 0; i < N; i++) {
25 int pi = i % 15;
26 delete( p[pi] );
27 p[pi] = new();
28 }
29 write(STDOUT_FILENO, "Stopping\n", sizeof("Stopping\n"));
30 for ( int pi = 0; pi < 15; pi++ ) {
31 delete( p[pi] );
32 }
33 write(STDOUT_FILENO, "Done\n", sizeof("Done\n"));
34}
Note: See TracBrowser for help on using the repository browser.