source: src/tests/preempt_longrun/yield.c @ 6926a6d

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since 6926a6d was 8ad6533, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

remove cfatime.h, move itimerval constructor to "time", update concurrent examples to use Duration

  • Property mode set to 100644
File size: 505 bytes
RevLine 
[cc3e4d0]1#include <kernel>
2#include <thread>
3
[70969f8]4#ifdef LONG_TEST
5static const unsigned long N = 9_750_000ul;
6#else
[cd99ef1]7static const unsigned long N = 325_000ul;
[70969f8]8#endif
[cd99ef1]9
[cc3e4d0]10#ifndef PREEMPTION_RATE
[8ad6533]11#define PREEMPTION_RATE 10`ms
[cc3e4d0]12#endif
13
[8ad6533]14Duration default_preemption() {
[cc3e4d0]15        return PREEMPTION_RATE;
16}
17
[0322865c]18thread worker_t {};
[cc3e4d0]19
[1449d83]20void main(worker_t & this) {
[cd99ef1]21        for(int i = 0; i < N; i++) {
[cc3e4d0]22                yield();
23        }
24}
25
[0322865c]26extern "C" {
27static worker_t * workers;
28}
29
[cc3e4d0]30int main(int argc, char* argv[]) {
31        processor p;
32        {
[0322865c]33                worker_t w[7];
34                workers = w;
[cc3e4d0]35        }
[1449d83]36}
Note: See TracBrowser for help on using the repository browser.