VirtualBox

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

Last change on this file since 7331 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1/* $Id: thread2-r0drv-solaris.c 5999 2007-12-07 15:05:06Z vboxsync $ */
2/** @file
3 * innotek Portable Runtime - Threads (Part 2), Ring-0 Driver, Solaris.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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* Header Files *
29*******************************************************************************/
30#include "the-solaris-kernel.h"
31
32#include <iprt/assert.h>
33#include <iprt/err.h>
34#include <iprt/thread.h>
35
36#include "internal/thread.h"
37
38int rtThreadNativeInit(void)
39{
40 return VINF_SUCCESS;
41}
42
43
44RTDECL(RTTHREAD) RTThreadSelf(void)
45{
46 return rtThreadGetByNative(RTThreadNativeSelf());
47}
48
49
50int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
51{
52 int iPriority;
53 switch (enmType)
54 {
55 case RTTHREADTYPE_INFREQUENT_POLLER: iPriority = 1; break;
56 case RTTHREADTYPE_EMULATION: iPriority = 25; break;
57 case RTTHREADTYPE_DEFAULT: iPriority = 53; break;
58 case RTTHREADTYPE_MSG_PUMP: iPriority = 75; break;
59 case RTTHREADTYPE_IO: iPriority = 100; break;
60 case RTTHREADTYPE_TIMER: iPriority = 127; break;
61 default:
62 AssertMsgFailed(("enmType=%d\n", enmType));
63 return VERR_INVALID_PARAMETER;
64 }
65
66 pri_t threadPrio = iPriority;
67 curthread->t_pri = threadPrio;
68 return VINF_SUCCESS;
69}
70
71
72int rtThreadNativeAdopt(PRTTHREADINT pThread)
73{
74 NOREF(pThread);
75 /* There is nothing special that needs doing here, but the
76 user really better know what he's cooking. */
77 return VINF_SUCCESS;
78}
79
80
81/**
82 * Native thread main function.
83 *
84 * @param pvThreadInt The thread structure.
85 */
86static void rtThreadNativeMain(void *pvThreadInt)
87{
88 PRTTHREADINT pThreadInt = (PRTTHREADINT)pvThreadInt;
89 int rc;
90
91 rc = rtThreadMain(pThreadInt, (RTNATIVETHREAD)curthread, &pThreadInt->szName[0]);
92 thread_exit();
93}
94
95
96int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
97{
98 int rc;
99 kthread_t* pKernThread = thread_create(NULL, NULL, rtThreadNativeMain, pThreadInt, 0,
100 curproc, LMS_USER, minclsyspri);
101 if (pKernThread)
102 {
103 *pNativeThread = (RTNATIVETHREAD)pKernThread;
104 return VINF_SUCCESS;
105 }
106
107 return RTErrConvertFromErrno(rc);
108}
109
Note: See TracBrowser for help on using the repository browser.

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