vbox的更動 21540 路徑 trunk/src/VBox/Runtime/r3/generic
- 時間撮記:
- 2009-7-13 下午02:51:23 (15 年 以前)
- 檔案:
-
- 複製 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r3/generic/semspinmutex-r3-generic.cpp
r21533 r21540 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Fast Mutex, Generic.3 * IPRT - Spinning Mutex Semaphores, Ring-3, Generic. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.7 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 #include <iprt/alloc.h> 39 39 #include <iprt/err.h> 40 #include <iprt/assert.h> 40 41 #include <iprt/critsect.h> 41 42 42 43 43 44 44 RTDECL(int) RTSem FastMutexCreate(PRTSEMFASTMUTEX pMutexSem)45 RTDECL(int) RTSemSpinMutexCreate(PRTSEMSPINMUTEX phSpinMtx, uint32_t fFlags) 45 46 { 47 AssertReturn(!(fFlags & ~RTSEMSPINMUTEX_FLAGS_VALID_MASK), VERR_INVALID_PARAMETER); 48 AssertPtr(phSpinMtx); 49 46 50 PRTCRITSECT pCritSect = (PRTCRITSECT)RTMemAlloc(sizeof(RTCRITSECT)); 47 51 if (!pCritSect) … … 50 54 if (RT_SUCCESS(rc)) 51 55 { 52 /** @todo pCritSect->fFlags |= RTCRITSECT_FLAGS_NO_NESTING; */53 *p MutexSem = (RTSEMFASTMUTEX)pCritSect;56 pCritSect->fFlags |= RTCRITSECT_FLAGS_NO_NESTING; 57 *phSpinMtx = (RTSEMSPINMUTEX)pCritSect; 54 58 } 55 59 else … … 57 61 return rc; 58 62 } 59 RT_EXPORT_SYMBOL(RTSem FastMutexCreate);63 RT_EXPORT_SYMBOL(RTSemSpinMutexCreate); 60 64 61 65 62 RTDECL(int) RTSem FastMutexDestroy(RTSEMFASTMUTEX MutexSem)66 RTDECL(int) RTSemSpinMutexDestroy(RTSEMSPINMUTEX hSpinMtx) 63 67 { 64 if ( MutexSem == NIL_RTSEMFASTMUTEX)68 if (hSpinMtx == NIL_RTSEMSPINMUTEX) 65 69 return VERR_INVALID_PARAMETER; 66 PRTCRITSECT pCritSect = (PRTCRITSECT) MutexSem;70 PRTCRITSECT pCritSect = (PRTCRITSECT)hSpinMtx; 67 71 int rc = RTCritSectDelete(pCritSect); 68 72 if (RT_SUCCESS(rc)) … … 70 74 return rc; 71 75 } 72 RT_EXPORT_SYMBOL(RTSem FastMutexDestroy);76 RT_EXPORT_SYMBOL(RTSemSpinMutexDestroy); 73 77 74 78 75 RTDECL(int) RTSem FastMutexRequest(RTSEMFASTMUTEX MutexSem)79 RTDECL(int) RTSemSpinMutexTryRequest(RTSEMSPINMUTEX hSpinMtx) 76 80 { 77 return RTCritSectEnter((PRTCRITSECT)MutexSem); 81 return RTCritSectTryEnter((PRTCRITSECT)hSpinMtx); 82 78 83 } 79 RT_EXPORT_SYMBOL(RTSem FastMutexRequest);84 RT_EXPORT_SYMBOL(RTSemSpinMutexTryRequest); 80 85 81 86 82 RTDECL(int) RTSem FastMutexRelease(RTSEMFASTMUTEX MutexSem)87 RTDECL(int) RTSemSpinMutexRequest(RTSEMSPINMUTEX hSpinMtx) 83 88 { 84 return RTCritSect Leave((PRTCRITSECT)MutexSem);89 return RTCritSectEnter((PRTCRITSECT)hSpinMtx); 85 90 } 86 RT_EXPORT_SYMBOL(RTSem FastMutexRelease);91 RT_EXPORT_SYMBOL(RTSemSpinMutexRequest); 87 92 93 94 RTDECL(int) RTSemSpinMutexRelease(RTSEMSPINMUTEX hSpinMtx) 95 { 96 return RTCritSectLeave((PRTCRITSECT)hSpinMtx); 97 } 98 RT_EXPORT_SYMBOL(RTSemSpinMutexRelease); 99
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器