VirtualBox

Ignore:
Timestamp:
Jul 13, 2009 2:49:39 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50009
Message:

iprt/thread.h: Redefined RTThreadPreemptIsEnabled for systems without preemption (we keep count ourselves). Added RTThreadPreemptIsPossible and RTThreadIsInInterrupt. Fixed RTThreadPreemptIsEnabled on FreeBSD and Solaris/vbi.

Location:
trunk/src/VBox/Runtime/r0drv/solaris
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c

    r20124 r21536  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
     
    3536
    3637#include <iprt/thread.h>
    37 #include <iprt/err.h>
    3838#include <iprt/asm.h>
    3939#include <iprt/assert.h>
     40#include <iprt/err.h>
    4041
    4142
     
    105106    if (curthread->t_preempt != 0)
    106107        return false;
    107 #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
    108     if (!(ASMGetFlags() & 0x00000200 /* X86_EFL_IF */))
     108    if (!ASMIntAreEnabled())
    109109        return false;
    110 #endif
    111110    return true;
    112111}
     
    125124{
    126125    /* yes, RTThreadPreemptIsPending is reliable. */
     126    return true;
     127}
     128
     129
     130RTDECL(bool) RTThreadPreemptIsPossible(void)
     131{
     132    /* yes, kernel preemption is possible. */
    127133    return true;
    128134}
     
    148154}
    149155
     156
     157RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread)
     158{
     159    Assert(hThread == NIL_RTTHREAD); NOREF(hThread);
     160    /** @todo Solaris: Implement RTThreadIsInInterrupt. Required for guest
     161     *        additions! */
     162    return !ASMIntAreEnabled();
     163}
     164
  • trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c

    r21452 r21536  
    2929 */
    3030
     31
    3132/*******************************************************************************
    3233*   Header Files                                                               *
     
    3536
    3637#include <iprt/thread.h>
     38#include <iprt/asm.h>
     39#include <iprt/assert.h>
    3740#include <iprt/err.h>
    38 #include <iprt/assert.h>
     41
    3942
    4043RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void)
     
    100103{
    101104    Assert(hThread == NIL_RTTHREAD);
    102     return vbi_is_preempt_enabled() != 0;
     105    if (    vbi_is_preempt_enabled()
     106        &&  ASMIntAreEnabled())
     107        return true;
     108    return false;
    103109}
    104110
     
    107113{
    108114    Assert(hThread == NIL_RTTHREAD);
    109     /** @todo Review this! */
    110115    return !!vbi_is_preempt_pending();
    111116}
     
    115120{
    116121    /* yes, RTThreadPreemptIsPending is reliable. */
     122    return true;
     123}
     124
     125
     126RTDECL(bool) RTThreadPreemptIsPossible(void)
     127{
     128    /* yes, kernel preemption is possible. */
    117129    return true;
    118130}
     
    136148}
    137149
     150
     151RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread)
     152{
     153    Assert(hThread == NIL_RTTHREAD); NOREF(hThread);
     154    /** @todo Solaris: Implement RTThreadIsInInterrupt. Required for guest
     155     *        additions! */
     156    return !ASMIntAreEnabled();
     157}
     158
Note: See TracChangeset for help on using the changeset viewer.

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