////////////////////////////////////////////////////////////
//
//     	Declaration of a class
//	AScheduleAttributes
//
//      Copyright 2001 
//
////////////////////////////////////////////////////////////

#ifndef __SCHEDULE_H__
#define __SCHEDULE_H__

#include <sched.h>

	// Attributes of a process' or a thread' schedule
	
class AScheduleAttributes
{
public:
	int status;
	
	// Attributes of a calling process schedule
	AScheduleAttributes()
	{ status=sched_getparam(0,&attributes);}
	
	// Attributes of a process_id process schedule
	// calling process: process_id==0
	AScheduleAttributes(pid_t process_id)
	{ set(process_id);}
	
	// Attributes of a process_id process schedule
	// calling process: process_id==0
	int set(pid_t process_id)
	{ status=sched_getparam(process_id,&attributes); return 0;}
	
	int set_priority(int priority)
	{ if( !status ) return -1; attributes.sched_priority=priority; return 0;}
	
	int get_priority(int& z)const
	{ if( !status ) return -1; z=attributes.sched_priority; return 0;}
	
	  
	int get(sched_param& z)const
	{ if( !status ) return -1; z=attributes; return 0;}
	
	
private:
	sched_param attributes;
};


#endif