VirtualBox

Ignore:
Timestamp:
Jan 28, 2007 8:45:05 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
17974
Message:

Need RTThreadWait in ring-0 too when using the generic timers, so thread.cpp was ported to ring-0. Fixed a bug in RTTimerStart() (the generic code). (hope this doesn't break the other platforms...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/thread.h

    r197 r403  
    2525#include <iprt/types.h>
    2626#include <iprt/thread.h>
     27#include <iprt/avl.h>
    2728#ifdef IN_RING3
    2829# include <iprt/process.h>
    2930# include <iprt/critsect.h>
    30 # include <iprt/avl.h>
    3131#endif
    3232
    3333__BEGIN_DECLS
    3434
    35 
    36 #ifdef IN_RING3
    3735
    3836
     
    8987    /** The current thread state. */
    9088    RTTHREADSTATE volatile  enmState;
    91 #ifdef __WIN__
     89#if defined(__WIN__) && defined(IN_RING3)
    9290    /** The thread handle.
    9391     * This is not valid until the create function has returned! */
     
    112110    /** Actual stack size. */
    113111    size_t                  cbStack;
     112#ifdef IN_RING3
    114113    /** What we're blocking on. */
    115114    union RTTHREADINTBLOCKID
     
    127126    /** Where we're blocking. */
    128127    RTUINTPTR volatile      uBlockId;
     128#endif /* IN_RING3 */
    129129    /** Thread name. */
    130130    char                    szName[RTTHREAD_NAME_LEN];
     
    154154 * Initialize the native part of the thread management.
    155155 *
    156  * Generally a TLS entry will be allocated at this point.
     156 * Generally a TLS entry will be allocated at this point (Ring-3).
    157157 *
    158158 * @returns iprt status code.
    159159 */
    160160int rtThreadNativeInit(void);
     161
     162/**
     163 * Create a native thread.
     164 * This creates the thread as described in pThreadInt and stores the thread id in *pThread.
     165 *
     166 * @returns iprt status code.
     167 * @param   pThreadInt      The thread data structure for the thread.
     168 * @param   pNativeThread   Where to store the native thread identifier.
     169 */
     170int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread);
     171
     172/**
     173 * Adopts a thread, this is called immediately after allocating the
     174 * thread structure.
     175 *
     176 * @param   pThread     Pointer to the thread structure.
     177 */
     178int rtThreadNativeAdopt(PRTTHREADINT pThread);
    161179
    162180/**
     
    174192int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType);
    175193
    176 /**
    177  * Create a native thread.
    178  * This creates the thread as described in pThreadInt and stores the thread id in *pThread.
    179  *
    180  * @returns iprt status code.
    181  * @param   pThreadInt      The thread data structure for the thread.
    182  * @param   pNativeThread   Where to store the native thread identifier.
    183  */
    184 int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread);
    185 
    186 /**
    187  * Adopts a thread, this is called immediately after allocating the
    188  * thread structure.
    189  *
    190  * @param   pThread     Pointer to the thread structure.
    191  */
    192 int rtThreadNativeAdopt(PRTTHREADINT pThread);
    193 
    194 #ifdef __WIN__
     194#ifdef IN_RING3
     195# ifdef __WIN__
    195196/**
    196197 * Callback for when a native thread is detaching.
     
    200201 */
    201202void rtThreadNativeDetach(void);
    202 #endif
    203 
    204 int rtThreadInit(void);
     203# endif
     204#endif /* !IN_RING0 */
     205
     206
     207/* thread.cpp */
    205208int rtThreadMain(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread);
    206 void rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread);
    207 PRTTHREADINT rtThreadGetByNative(RTNATIVETHREAD NativeThread);
    208 PRTTHREADINT rtThreadGet(RTTHREAD Thread);
    209 uint32_t rtThreadRelease(PRTTHREADINT pThread);
    210 int rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority);
    211 void rtThreadTerminate(PRTTHREADINT pThread, int rc);
    212209void rtThreadBlocking(PRTTHREADINT pThread, RTTHREADSTATE enmState, uint64_t u64Block,
    213210                      const char *pszFile, unsigned uLine, RTUINTPTR uId);
    214211void rtThreadUnblocked(PRTTHREADINT pThread, RTTHREADSTATE enmCurState);
    215 
    216 
    217 #elif defined(IN_RING0)
    218 
    219 /**
    220  * Argument package for a ring-0 thread.
    221  */
    222 typedef struct RTR0THREADARGS
    223 {
    224     /** The thread function. */
    225     PFNRTTHREAD     pfnThread;
    226     /** The thread function argument. */
    227     void           *pvUser;
    228     /** The thread type. */
    229     RTTHREADTYPE    enmType;
    230 } RTR0THREADARGS, *PRTR0THREADARGS;
    231 
    232 
    233 
    234 int rtThreadMain(PRTR0THREADARGS pArgs, RTNATIVETHREAD NativeThread);
    235 
    236 /**
    237  * Do the actual thread creation.
    238  *
    239  * @returns IPRT status code.
    240  *          On failure, no thread has been created.
    241  * @param   pArgs           The argument package.
    242  * @param   pNativeThread   Where to return the native thread handle.
    243  */
    244 int rtThreadNativeCreate(PRTR0THREADARGS pArgs, PRTNATIVETHREAD pNativeThread);
    245 
    246 /**
    247  * Do the actual thread priority change.
    248  *
    249  * @returns IPRT status code.
    250  * @param   Thread      The thread which priority should be changed.
    251  *                      This is currently restricted to the current thread.
    252  * @param   enmType     The new thread priority type (valid).
    253  */
    254 int rtThreadNativeSetPriority(RTTHREAD Thread, RTTHREADTYPE enmType);
    255 
     212uint32_t rtThreadRelease(PRTTHREADINT pThread);
     213void rtThreadTerminate(PRTTHREADINT pThread, int rc);
     214PRTTHREADINT rtThreadGetByNative(RTNATIVETHREAD NativeThread);
     215PRTTHREADINT rtThreadGet(RTTHREAD Thread);
     216int rtThreadInit(void);
     217void rtThreadTerm(void);
     218void rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThread);
     219#ifdef IN_RING3
     220int rtThreadDoSetProcPriority(RTPROCPRIORITY enmPriority);
    256221#endif /* !IN_RING0 */
    257222
Note: See TracChangeset for help on using the changeset viewer.

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