//                              -*- Mode: CFA -*-
//
// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// preemption.h --
//
// Author           : Thierry Delisle
// Created On       : Mon Jun 5 14:20:42 2017
// Last Modified By : Thierry Delisle
// Last Modified On : --
// Update Count     : 0
//

#ifndef PREEMPTION_H
#define PREEMPTION_H

#include "alarm.h"
#include "kernel_private.h"

__attribute__((weak)) unsigned int default_preemption();
void kernel_start_preemption();
void kernel_stop_preemption();
void update_preemption( processor * this, __cfa_time_t duration );
void tick_preemption();

struct preemption_scope {
	alarm_node_t alarm;
	processor * proc;
};

void ?{}( preemption_scope & this, processor * proc );
void ^?{}( preemption_scope & this );

#endif //PREEMPTION_H
