1/*
2 * Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#include <stdlib.h>
11#include <stdio.h>
12#include <barrelfish/barrelfish.h>
13
14static int yield_thread(void *dummy)
15{
16    for(;;) {
17        thread_yield();
18    }
19    return -1;
20}
21
22static int worker_thread(void *dummy)
23{
24    for(;;);
25    return -1;
26}
27
28int main(int argc, char *argv[])
29{
30  //    assert(argc == 3);
31
32  int yielders = 1; //atoi(argv[1]);
33  int workers = 0; //atoi(argv[2]);
34
35    printf("Yield test. Yielders: %d, workers: %d\n", yielders, workers);
36
37    for(int i = 0; i < yielders; i++) {
38        struct thread *t = thread_create(yield_thread, NULL);
39        errval_t err = thread_detach(t);
40        assert(err_is_ok(err));
41    }
42
43    for(int i = 0; i < workers; i++) {
44        struct thread *t = thread_create(worker_thread, NULL);
45        errval_t err = thread_detach(t);
46        assert(err_is_ok(err));
47    }
48
49    thread_exit(0);
50}
51