#include <stdio.h>
#include <errno.h>
#include <error.h>
#include <unistd.h>
#include <sched.h>

struct sched_param displayParam() {
	struct sched_param param;
	if (!sched_getparam(0, &param)) {
		printf("prio=%d\n", param.sched_priority);
	} else {
		error(0, errno, "cannot get scheduling parameters : sched_getparam");
	}
	return param;
}

int main() {
	struct sched_param param = displayParam();
	param.sched_priority = 1;
	if (sched_setscheduler(0, SCHED_FIFO, &param) == 0) {
		puts("Reussite");
		puts("Je vais bloquer le systeme");
		sleep(1);
		int i;
		for (i=0;i<299900022;i++);
		puts("debloquage");
	} else {
		puts("Echec");
	}
	return 0;
}
