sched-generic.cpp revision aa4bcf0a4b2db3ac352b56a291d49cb8d4b66d32
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/* $Id$ */
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/** @file
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * IPRT - Scheduling, generic stubs.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync */
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/*
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * available from http://www.virtualbox.org. This file is free software;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * you can redistribute it and/or modify it under the terms of the GNU
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * General Public License (GPL) as published by the Free Software
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * The contents of this file may alternatively be used under the terms
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * of the Common Development and Distribution License Version 1.0
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * VirtualBox OSE distribution, in which case the provisions of the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * CDDL are applicable instead of those of the GPL.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * You may elect to license modified versions of this file under the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * terms and conditions of either the GPL or the CDDL or both.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * additional information or have any questions.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync */
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/*******************************************************************************
671242f350d172e106580348e24bab66b0d7e6a5vboxsync* Header Files *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync*******************************************************************************/
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#define LOG_GROUP RTLOGGROUP_THREAD
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#include <iprt/thread.h>
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#include "internal/iprt.h"
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#include <iprt/log.h>
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#include <iprt/assert.h>
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#include <iprt/err.h>
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#include "internal/sched.h"
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/**
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Calculate the scheduling properties for all the threads in the default
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * process priority, assuming the current thread have the type enmType.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @returns iprt status code.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @param enmType The thread type to be assumed for the current thread.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync */
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncint rtSchedNativeCalcDefaultPriority(RTTHREADTYPE enmType)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync{
671242f350d172e106580348e24bab66b0d7e6a5vboxsync Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync return VINF_SUCCESS;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync}
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/**
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Validates and sets the process priority.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * This will check that all rtThreadNativeSetPriority() will success for all the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * thread types when applied to the current thread.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @returns iprt status code.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @param enmPriority The priority to validate and set.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @remark Located in sched.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync */
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncint rtProcNativeSetPriority(RTPROCPRIORITY enmPriority)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync{
671242f350d172e106580348e24bab66b0d7e6a5vboxsync Assert(enmPriority > RTPROCPRIORITY_INVALID && enmPriority < RTPROCPRIORITY_LAST);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync return VINF_SUCCESS;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync}
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync/**
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * Sets the priority of the thread according to the thread type
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * and current process priority.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * The RTTHREADINT::enmType member has not yet been updated and will be updated by
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * the caller on a successful return.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync *
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @returns iprt status code.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @param pThread The thread in question.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @param enmType The thread type.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync * @remark Located in sched.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync */
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncint rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync{
671242f350d172e106580348e24bab66b0d7e6a5vboxsync Assert(enmType > RTTHREADTYPE_INVALID && enmType < RTTHREADTYPE_END);
671242f350d172e106580348e24bab66b0d7e6a5vboxsync return VINF_SUCCESS;
671242f350d172e106580348e24bab66b0d7e6a5vboxsync}
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync