VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1/* $Id: thread2-r0drv-solaris.c 4071 2007-08-07 17:07:59Z 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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include "the-solaris-kernel.h"
22
23#include <iprt/assert.h>
24#include <iprt/err.h>
25#include <iprt/thread.h>
26
27#include "internal/thread.h"
28
29int rtThreadNativeInit(void)
30{
31 return VINF_SUCCESS;
32}
33
34
35RTDECL(RTTHREAD) RTThreadSelf(void)
36{
37 return rtThreadGetByNative(RTThreadNativeSelf());
38}
39
40
41/** @todo Solaris native threading, when more info. on priority etc. (namely default prio value) is available */
42int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
43{
44 int iPriority;
45 switch (enmType)
46 {
47 case RTTHREADTYPE_INFREQUENT_POLLER: iPriority = 1; break;
48 case RTTHREADTYPE_EMULATION: iPriority = 25; break;
49 case RTTHREADTYPE_DEFAULT: iPriority = 53; break;
50 case RTTHREADTYPE_MSG_PUMP: iPriority = 75; break;
51 case RTTHREADTYPE_IO: iPriority = 100; break;
52 case RTTHREADTYPE_TIMER: iPriority = 127; break;
53 default:
54 AssertMsgFailed(("enmType=%d\n", enmType));
55 return VERR_INVALID_PARAMETER;
56 }
57
58 THREAD_CHANGE_PRI(curthread, iPriority);
59 return VINF_SUCCESS;
60}
61
62
63int rtThreadNativeAdopt(PRTTHREADINT pThread)
64{
65 NOREF(pThread);
66 /* There is nothing special that needs doing here, but the
67 user really better know what he's cooking. */
68 return VINF_SUCCESS;
69}
70
71
72/**
73 * Native thread main function.
74 *
75 * @param pvThreadInt The thread structure.
76 */
77static void rtThreadNativeMain(void *pvThreadInt)
78{
79 PRTTHREADINT pThreadInt = (PRTTHREADINT)pvThreadInt;
80 int rc;
81
82 rc = rtThreadMain(pThreadInt, (RTNATIVETHREAD)curthread, &pThreadInt->szName[0]);
83 thread_exit();
84}
85
86
87int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
88{
89 int rc;
90 /** @todo passing hardcoded priority: 52. Find what default priority to pass */
91 /* We know its from 0 to 127 priority, but what's the default?? */
92 kthread_t* pKernThread = thread_create(NULL, NULL, rtThreadNativeMain, pThreadInt, 0,
93 curproc, LMS_USER, 52);
94 if (rc == 0)
95 {
96 *pNativeThread = (RTNATIVETHREAD)pKernThread;
97 return VINF_SUCCESS;
98 }
99
100 return RTErrConvertFromErrno(rc);
101}
102
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