Main Page   File List  

prio.h

Go to the documentation of this file.
00001 
00009 /* (c) 2004 Technische Universität Dresden
00010  * This file is part of DROPS, which is distributed under the terms of the
00011  * GNU General Public License 2. Please see the COPYING file for details.
00012  */
00013 #ifndef __L4UTIL__PRIO_H__
00014 #define __L4UTIL__PRIO_H__
00015 
00016 #include <l4/sys/syscalls.h>
00017 
00018 EXTERN_C_BEGIN
00019 
00031 static inline int
00032 l4util_prio_thread_set(l4_threadid_t id, unsigned prio)
00033 {
00034   l4_sched_param_t p;
00035   l4_threadid_t dummy = L4_INVALID_ID;
00036 
00037   l4_thread_schedule(id, L4_INVALID_SCHED_PARAM, &dummy, &dummy, &p);
00038 
00039   if (!l4_is_invalid_sched_param(p))
00040     {
00041       p.sp.prio  = prio;
00042       p.sp.state = 0;
00043       l4_thread_schedule(id, p, &dummy, &dummy, &p);
00044       if (!l4_is_invalid_sched_param(p))
00045         return 0;
00046     }
00047 
00048   return 1;
00049 }
00050 
00051 EXTERN_C_END
00052 
00053 #endif /* ! __L4UTIL__PRIO_H__ */

L4 Utilities, part of DROPS  © 2000-2003