VirtualBox

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

Last change on this file since 27727 was 24386, checked in by vboxsync, 15 years ago

Solaris/r0drv: Merge VBI into IPRT.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: thread2-r0drv-solaris.c 24386 2009-11-05 14:17:10Z 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/*******************************************************************************
33* Header Files *
34*******************************************************************************/
35#include "../the-solaris-kernel.h"
36#include "internal/iprt.h"
37#include <iprt/thread.h>
38
39#include <iprt/assert.h>
40#include <iprt/err.h>
41#include "internal/thread.h"
42
43
44
45int rtThreadNativeInit(void)
46{
47 return VINF_SUCCESS;
48}
49
50
51RTDECL(RTTHREAD) RTThreadSelf(void)
52{
53 return rtThreadGetByNative(RTThreadNativeSelf());
54}
55
56
57int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
58{
59 int iPriority;
60 switch (enmType)
61 {
62 case RTTHREADTYPE_INFREQUENT_POLLER: iPriority = 60; break;
63 case RTTHREADTYPE_EMULATION: iPriority = 66; break;
64 case RTTHREADTYPE_DEFAULT: iPriority = 72; break;
65 case RTTHREADTYPE_MSG_PUMP: iPriority = 78; break;
66 case RTTHREADTYPE_IO: iPriority = 84; break;
67 case RTTHREADTYPE_TIMER: iPriority = 99; break;
68 default:
69 AssertMsgFailed(("enmType=%d\n", enmType));
70 return VERR_INVALID_PARAMETER;
71 }
72
73 vbi_set_priority(vbi_curthread(), iPriority);
74 return VINF_SUCCESS;
75}
76
77
78int rtThreadNativeAdopt(PRTTHREADINT pThread)
79{
80 NOREF(pThread);
81 /* There is nothing special that needs doing here, but the
82 user really better know what he's cooking. */
83 return VINF_SUCCESS;
84}
85
86
87/**
88 * Native thread main function.
89 *
90 * @param pvThreadInt The thread structure.
91 */
92static void rtThreadNativeMain(void *pvThreadInt)
93{
94 PRTTHREADINT pThreadInt = (PRTTHREADINT)pvThreadInt;
95
96 rtThreadMain(pThreadInt, (RTNATIVETHREAD)vbi_curthread(), &pThreadInt->szName[0]);
97 vbi_thread_exit();
98}
99
100
101int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
102{
103 void *pvKernThread;
104 RT_ASSERT_PREEMPTIBLE();
105
106 pvKernThread = vbi_thread_create(rtThreadNativeMain, pThreadInt, sizeof(pThreadInt), minclsyspri);
107 if (pvKernThread)
108 {
109 *pNativeThread = (RTNATIVETHREAD)pvKernThread;
110 return VINF_SUCCESS;
111 }
112
113 return VERR_OUT_OF_RESOURCES;
114}
115
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