1/**
2 * \file
3 * \brief
4 */
5
6/*
7 * Copyright (c) 2010, ETH Zurich and Mircosoft Corporation.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#include "internal.h"
16
17static bool leader;
18static coreid_t leader_id;
19
20bool check_leader(void)
21{
22    return leader;
23}
24
25coreid_t get_leader_id(void)
26{
27    return leader_id;
28}
29
30errval_t set_leader(callback cb)
31{
32    if (global_argc == 1) {
33        leader = true;
34        leader_id = my_core_id;
35    } else {
36        leader = false;
37        leader_id = strtol(global_argv[1], NULL, 10);
38    }
39
40    cb();
41    return SYS_ERR_OK;
42}
43