VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c@ 11280

Last change on this file since 11280 was 9149, checked in by vboxsync, 17 years ago

New VBI code for Solaris.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1/* $Id: thread2-r0drv-solaris.c 9149 2008-05-27 09:27:29Z vboxsync $ */
2/** @file
3 * IPRT - Threads (Part 2), Ring-0 Driver, Solaris.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 *
26 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31/*******************************************************************************
32* Header Files *
33*******************************************************************************/
34#include "the-solaris-kernel.h"
35
36#include <iprt/assert.h>
37#include <iprt/err.h>
38#include <iprt/thread.h>
39
40#include "internal/thread.h"
41
42int rtThreadNativeInit(void)
43{
44 return VINF_SUCCESS;
45}
46
47
48RTDECL(RTTHREAD) RTThreadSelf(void)
49{
50 return rtThreadGetByNative(RTThreadNativeSelf());
51}
52
53
54int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
55{
56 int iPriority;
57 switch (enmType)
58 {
59 case RTTHREADTYPE_INFREQUENT_POLLER: iPriority = 60; break;
60 case RTTHREADTYPE_EMULATION: iPriority = 66; break;
61 case RTTHREADTYPE_DEFAULT: iPriority = 72; break;
62 case RTTHREADTYPE_MSG_PUMP: iPriority = 78; break;
63 case RTTHREADTYPE_IO: iPriority = 84; break;
64 case RTTHREADTYPE_TIMER: iPriority = 99; break;
65 default:
66 AssertMsgFailed(("enmType=%d\n", enmType));
67 return VERR_INVALID_PARAMETER;
68 }
69
70 vbi_set_priority(vbi_curthread(), iPriority);
71 return VINF_SUCCESS;
72}
73
74
75int rtThreadNativeAdopt(PRTTHREADINT pThread)
76{
77 NOREF(pThread);
78 /* There is nothing special that needs doing here, but the
79 user really better know what he's cooking. */
80 return VINF_SUCCESS;
81}
82
83
84/**
85 * Native thread main function.
86 *
87 * @param pvThreadInt The thread structure.
88 */
89static void rtThreadNativeMain(void *pvThreadInt)
90{
91 PRTTHREADINT pThreadInt = (PRTTHREADINT)pvThreadInt;
92 int rc;
93
94 rc = rtThreadMain(pThreadInt, (RTNATIVETHREAD)vbi_curthread(), &pThreadInt->szName[0]);
95 vbi_thread_exit();
96}
97
98
99int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
100{
101 int rc;
102 void *pKernThread = vbi_thread_create(rtThreadNativeMain, pThreadInt,
103 sizeof (pThreadInt), minclsyspri);
104 if (pKernThread)
105 {
106 *pNativeThread = (RTNATIVETHREAD)pKernThread;
107 return VINF_SUCCESS;
108 }
109
110 return RTErrConvertFromErrno(rc);
111}
112
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette