VirtualBox

source: vbox/trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c@ 28800

最後變更 在這個檔案從28800是 28800,由 vboxsync 提交於 15 年 前

Automated rebranding to Oracle copyright/license strings via filemuncher

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.1 KB
 
1/* $Id: thread-r0drv-solaris.c 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * IPRT - Threads, Ring-0 Driver, Solaris.
4 */
5
6/*
7 * Copyright (C) 2006-2009 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.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/asm.h>
36#include <iprt/assert.h>
37#include <iprt/err.h>
38#include <iprt/mp.h>
39
40
41
42RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
43{
44 return (RTNATIVETHREAD)vbi_curthread();
45}
46
47
48RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies)
49{
50 clock_t cTicks;
51 RT_ASSERT_PREEMPTIBLE();
52
53 if (!cMillies)
54 {
55 RTThreadYield();
56 return VINF_SUCCESS;
57 }
58
59 if (cMillies != RT_INDEFINITE_WAIT)
60 cTicks = drv_usectohz((clock_t)(cMillies * 1000L));
61 else
62 cTicks = 0;
63
64 delay(cTicks);
65 return VINF_SUCCESS;
66}
67
68
69RTDECL(bool) RTThreadYield(void)
70{
71 RT_ASSERT_PREEMPTIBLE();
72 return vbi_yield();
73}
74
75
76RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread)
77{
78 Assert(hThread == NIL_RTTHREAD);
79 if (!vbi_is_preempt_enabled())
80 return false;
81 if (!ASMIntAreEnabled())
82 return false;
83 if (getpil() >= DISP_LEVEL)
84 return false;
85 return true;
86}
87
88
89RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread)
90{
91 Assert(hThread == NIL_RTTHREAD);
92 return !!vbi_is_preempt_pending();
93}
94
95
96RTDECL(bool) RTThreadPreemptIsPendingTrusty(void)
97{
98 /* yes, RTThreadPreemptIsPending is reliable. */
99 return true;
100}
101
102
103RTDECL(bool) RTThreadPreemptIsPossible(void)
104{
105 /* yes, kernel preemption is possible. */
106 return true;
107}
108
109
110RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState)
111{
112 AssertPtr(pState);
113
114 vbi_preempt_disable();
115
116 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);
117}
118
119
120RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
121{
122 AssertPtr(pState);
123 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
124
125 vbi_preempt_enable();
126}
127
128
129RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread)
130{
131 Assert(hThread == NIL_RTTHREAD);
132 return servicing_interrupt() ? true : false;
133}
134
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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