VirtualBox

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

Last change on this file since 40227 was 36555, checked in by vboxsync, 14 years ago

Use DECLHIDDEN, especially in IPRT.

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