HMODULE GetCLRModule ();
-#ifndef FEATURE_NO_HOST
-/*
- Here we start the list of functions we want to deprecate.
- We use a define to generate a linker error.
- We must insure to include the header file that has the definition we are about
- to deprecate before we use the #define otherwise we will run into a linker error
- when legitimately undef'ing the function
-*/
-
-//
-// following are windows deprecates
-//
-#include <windows.h>
-
-/*
- If you are reading this, you have probably tracked down the fact that memory Alloc,
- etc. don't work inside your DLL because you are using src\inc & src\utilcode
- services.
- You need to use the ClrXXX equivalent functions to properly guarantee your code
- works correctly wrt hosting and others execution engine requirements.
- Check the list of Clr functions above
-*/
-
-#define GetProcessHeap() \
- Dont_Use_GetProcessHeap()
-
-#define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect) \
- Dont_Use_VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect)
-
-#define VirtualFree(lpAddress, dwSize, dwFreeType) \
- Dont_Use_VirtualFree(lpAddress, dwSize, dwFreeType)
-
-#define VirtualQuery(lpAddress, lpBuffer, dwLength) \
- Dont_Use_VirtualQuery(lpAddress, lpBuffer, dwLength)
-
-#define VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) \
- Dont_Use_VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect)
-
-#define HeapCreate(flOptions, dwInitialSize, dwMaximumSize) \
- Dont_Use_HeapCreate(flOptions, dwInitialSize, dwMaximumSize)
-
-#define HeapDestroy(hHeap) \
- Dont_Use_HeapDestroy(hHeap)
-
-#define HeapAlloc(hHeap, dwFlags, dwBytes) \
- Dont_Use_HeapAlloc(hHeap, dwFlags, dwBytes)
-
-#define HeapReAlloc(hHeap, dwFlags, lpMem, dwBytes) \
- Dont_Use_HeapReAlloc(hHeap, dwFlags, lpMem, dwBytes)
-
-#define HeapFree(hHeap, dwFlags, lpMem) \
- Dont_Use_HeapFree(hHeap, dwFlags, lpMem)
-
-#define HeapValidate(hHeap, dwFlags, lpMem) \
- Dont_Use_HeapValidate(hHeap, dwFlags, lpMem)
-
-#define LocalAlloc(uFlags, uBytes) \
- Dont_Use_LocalAlloc(uFlags, uBytes)
-
-#define LocalFree(hMem) \
- Dont_Use_LocalFree(hMem)
-
-#define LocalReAlloc(hMem, uBytes, uFlags) \
- Dont_Use_LocalReAlloc(hMem, uBytes, uFlags)
-
-#define GlobalAlloc(uFlags, dwBytes) \
- Dont_Use_GlobalAlloc(uFlags, dwBytes)
-
-#define GlobalFree(hMem) \
- Dont_Use_GlobalFree(hMem)
-
-//#define ExitThread Dont_Use_ExitThread
-
-#define ExitProcess Dont_Use_ExitProcess
-
-/*
- If you are reading this, you have probably tracked down the fact that TlsAlloc,
- etc. don't work inside your DLL because you are using src\inc & src\utilcode
- services.
-
- This is because the CLR can operate in a fiberized environment under host control.
- When this is the case, logical thread local storage must be fiber-relative rather
- than thread-relative.
-
- Although the OS provides FLS routines on .NET Server, it does not yet provide
- those services on WinXP or Win2K. So you cannot just use fiber routines from
- the OS.
-
- Instead, you must use the ClrFls_ routines described above. However, there are
- some important differences between these EE-provided services and the OS TLS
- services that you are used to:
-
- 1) There is no TlsAlloc/FlsAlloc equivalent. You must statically describe
- your needs via the PredefinedTlsSlots below. If you have dynamic requirements,
- you should give yourself a single static slot and then build your dynamic
- requirements on top of this. The lack of a dynamic API is a deliberate
- choice on my part, rather than lack of time.
-
- 2) You can provide a cleanup routine, which we will call on your behalf. However,
- this can be called on a different thread than the "thread" (fiber or thread)
- which holds the data. It can be called after that thread has actually been
- terminated. It can be called before you see a DLL_THREAD_DETACH on your
- physical thread. The circumstances vary based on whether the process is hosted
- and based on whether TS_WeOwn is set on the internal Thread object. Make
- no assumptions here.
-*/
-#define TlsAlloc() \
- Dont_Use_TlsAlloc()
-
-#define TlsSetValue(dwTlsIndex, lpTlsValue) \
- Dont_Use_TlsSetValue(dwTlsIndex, lpTlsValue)
-
-#define TlsGetValue(dwTlsIndex) \
- Dont_Use_TlsGetValue(dwTlsIndex)
-
-#define TlsFree(dwTlsIndex) \
- Dont_Use_TlsFree(dwTlsIndex)
-
-
-/*
- If you are reading this, you have probably tracked down the fact that synchronization objects
- and critical sections don't work inside your DLL because you are using src\inc & src\utilcode services.
- Please refer to the ClrXXX functions described above to make proper use of synchronization obejct, etc.
-
- Also it's extremely useful to look at the Holder classes defined above.
- Those classes provide a nice encapsulation for synchronization object that allows automatic release of locks.
-*/
-#define InitializeCriticalSection(lpCriticalSection) \
- Dont_Use_InitializeCriticalSection(lpCriticalSection)
-
-#define InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount) \
- Dont_Use_InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount)
-
-#define DeleteCriticalSection(lpCriticalSection) \
- Dont_Use_DeleteCriticalSection(lpCriticalSection)
-
-#define EnterCriticalSection(lpCriticalSection) \
- Dont_Use_EnterCriticalSection(lpCriticalSection)
-
-#define TryEnterCriticalSection(lpCriticalSection) \
- Dont_Use_TryEnterCriticalSection(lpCriticalSection)
-
-#define LeaveCriticalSection(lpCriticalSection) \
- Dont_Use_LeaveCriticalSection(lpCriticalSection)
-
-#ifdef CreateEvent
-#undef CreateEvent
-#endif
-#define CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName) \
- Dont_Use_CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName)
-
-#ifdef OpenEvent
-#undef OpenEvent
-#endif
-#define OpenEvent(dwDesiredAccess, bInheritHandle, lpName) \
- Dont_Use_OpenEvent(dwDesiredAccess, bInheritHandle, lpName)
-
-#define ResetEvent(hEvent) \
- Dont_Use_ResetEvent(hEvent)
-
-#define SetEvent(hEvent) \
- Dont_Use_SetEvent(hEvent)
-
-#define PulseEvent(hEvent) \
- Dont_Use_PulseEvent(hEvent)
-
-#ifdef CreateSemaphore
-#undef CreateSemaphore
-#endif
-#define CreateSemaphore(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName) \
- Dont_Use_CreateSemaphore(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName)
-
-#ifdef OpenSemaphore
-#undef OpenSemaphore
-#endif
-#define OpenSemaphore(dwDesiredAccess, bInheritHandle, lpName) \
- Dont_Use_OpenSemaphore(dwDesiredAccess, bInheritHandle, lpName)
-
-#define ReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount) \
- Dont_Use_ReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount)
-
-#ifdef Sleep
-#undef Sleep
-#endif
-#define Sleep(dwMilliseconds) \
- Dont_Use_Sleep(dwMilliseconds)
-
-#ifdef SleepEx
-#undef SleepEx
-#endif
-#define SleepEx(dwMilliseconds,bAlertable) \
- Dont_Use_SleepEx(dwMilliseconds,bAlertable)
-
-//
-// following are clib deprecates
-//
-#include <stdlib.h>
-#include <malloc.h>
-
-#ifdef malloc
-#undef malloc
-#endif
-
-#define _CRT_EXCEPTION_NO_MALLOC
-#define malloc(size) \
- Dont_Use_malloc(size)
-
-#ifdef realloc
-#undef realloc
-#endif
-#define realloc(memblock, size) \
- Dont_Use_realloc(memblock, size)
-
-#ifdef free
-#undef free
-#endif
-#define free(memblock) \
- Dont_Use_free(memblock)
-
-#endif //!FEATURE_NO_HOST
-
extern void IncCantAllocCount();
extern void DecCantAllocCount();
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-
-
-#ifndef __UNSAFE_H__
-#define __UNSAFE_H__
-
-// should we just check proper inclusion?
-#include <winwrap.h>
-
-#include "staticcontract.h"
-
-inline VOID UnsafeEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
- STATIC_CONTRACT_LEAF;
- EnterCriticalSection(lpCriticalSection);
-}
-
-inline VOID UnsafeLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
- STATIC_CONTRACT_LEAF;
- LeaveCriticalSection(lpCriticalSection);
-}
-
-inline BOOL UnsafeTryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
- STATIC_CONTRACT_LEAF;
- return TryEnterCriticalSection(lpCriticalSection);
-}
-
-inline VOID UnsafeInitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
- STATIC_CONTRACT_LEAF;
- InitializeCriticalSection(lpCriticalSection);
-}
-
-inline VOID UnsafeDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
-{
- STATIC_CONTRACT_LEAF;
- DeleteCriticalSection(lpCriticalSection);
-}
-
-inline HANDLE UnsafeCreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName)
-{
- STATIC_CONTRACT_WRAPPER;
- return WszCreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName);
-}
-
-inline BOOL UnsafeSetEvent(HANDLE hEvent)
-{
- STATIC_CONTRACT_LEAF;
- return SetEvent(hEvent);
-}
-
-inline BOOL UnsafeResetEvent(HANDLE hEvent)
-{
- STATIC_CONTRACT_LEAF;
- return ResetEvent(hEvent);
-}
-
-inline HANDLE UnsafeCreateSemaphore(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName)
-{
- STATIC_CONTRACT_WRAPPER;
- return WszCreateSemaphore(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName);
-}
-
-inline BOOL UnsafeReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount)
-{
- STATIC_CONTRACT_LEAF;
- return ReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount);
-}
-
-inline LPVOID UnsafeTlsGetValue(DWORD dwTlsIndex)
-{
- STATIC_CONTRACT_LEAF;
- return TlsGetValue(dwTlsIndex);
-}
-
-inline BOOL UnsafeTlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue)
-{
- STATIC_CONTRACT_LEAF;
- return TlsSetValue(dwTlsIndex, lpTlsValue);
-}
-
-inline DWORD UnsafeTlsAlloc(void)
-{
- STATIC_CONTRACT_LEAF;
- return TlsAlloc();
-}
-
-inline BOOL UnsafeTlsFree(DWORD dwTlsIndex)
-{
- STATIC_CONTRACT_LEAF;
- return TlsFree(dwTlsIndex);
-}
-
-#endif
-
-
#undef GetTimeFormat
#undef LCMapString
-// winnetwk.h
-#undef WNetGetConnection
-
-// Win32 Fusion API's
-#undef QueryActCtxW
-
#endif // !defined(__TODO_PORT_TO_WRAPPERS__)
//
#define WszMultiByteToWideChar MultiByteToWideChar
#define WszWideCharToMultiByte WideCharToMultiByte
#define WszCreateSemaphore CreateSemaphoreW
-#define WszQueryActCtxW QueryActCtxW
#ifdef FEATURE_CORESYSTEM
#pragma function(memcpy,memcmp,strcmp,strcpy,strlen,strcat)
#endif // _MSC_VER
-// make all the unsafe redefinitions available
-#include "unsafe.h"
-
//-----------------------------------------------------------------------------------------------------------
#include "lazycow.h"
#include "stdafx.h"
-#include "unsafe.h"
#include "clrhost.h"
#include "utilcode.h"
#include "ex.h"
#include "stdafx.h"
-#include "unsafe.h"
#include "clrhost.h"
#include "utilcode.h"
#include "ex.h"
#include "clrinternal.h"
#include "hostimpl.h"
#include "predeftlsslot.h"
-#include "unsafe.h"
// to avoid to include clrhost.h in this file
#ifdef FAILPOINTS_ENABLED
//
LPVOID* ClrFlsGetBlockDirect()
{
- return (LPVOID*)UnsafeTlsGetValue(TlsIndex);
+ return (LPVOID*)TlsGetValue(TlsIndex);
}
//
// Ensure we have a TLS Index
if (TlsIndex == TLS_OUT_OF_INDEXES)
{
- DWORD tmp = UnsafeTlsAlloc();
+ DWORD tmp = TlsAlloc();
if (InterlockedCompareExchange((LONG*)&TlsIndex, tmp, TLS_OUT_OF_INDEXES) != (LONG) TLS_OUT_OF_INDEXES)
{
// We lost the race with another thread.
- UnsafeTlsFree(tmp);
+ TlsFree(tmp);
}
// Switch to faster TLS getter now that the TLS slot is initialized
}
for (int i=0; i<MAX_PREDEFINED_TLS_SLOT; i++)
pTlsData[i] = 0;
- UnsafeTlsSetValue(TlsIndex, pTlsData);
+ TlsSetValue(TlsIndex, pTlsData);
}
return pTlsData;
VOID STDMETHODCALLTYPE TLS_FreeMasterSlotIndex()
{
if (TlsIndex != TLS_OUT_OF_INDEXES)
- if (UnsafeTlsFree(TlsIndex))
+ if (TlsFree(TlsIndex))
TlsIndex = TLS_OUT_OF_INDEXES;
} // TLS_FreeMasterSlotIndex
if (TlsIndex == TLS_OUT_OF_INDEXES)
return NULL;
- return (LPVOID *)UnsafeTlsGetValue(TlsIndex);
+ return (LPVOID *)TlsGetValue(TlsIndex);
}
LPVOID STDMETHODCALLTYPE UtilExecutionEngine::TLS_GetValue(DWORD slot)
CRITSEC_COOKIE STDMETHODCALLTYPE UtilExecutionEngine::CreateLock(LPCSTR szTag, LPCSTR level, CrstFlags flags)
{
CRITICAL_SECTION *cs = (CRITICAL_SECTION*)malloc(sizeof(CRITICAL_SECTION));
- UnsafeInitializeCriticalSection(cs);
+ InitializeCriticalSection(cs);
return (CRITSEC_COOKIE)cs;
}
void STDMETHODCALLTYPE UtilExecutionEngine::DestroyLock(CRITSEC_COOKIE lock)
{
_ASSERTE(lock);
- UnsafeDeleteCriticalSection((CRITICAL_SECTION*)lock);
+ DeleteCriticalSection((CRITICAL_SECTION*)lock);
free(lock);
}
void STDMETHODCALLTYPE UtilExecutionEngine::AcquireLock(CRITSEC_COOKIE lock)
{
_ASSERTE(lock);
- UnsafeEnterCriticalSection((CRITICAL_SECTION*)lock);
+ EnterCriticalSection((CRITICAL_SECTION*)lock);
}
void STDMETHODCALLTYPE UtilExecutionEngine::ReleaseLock(CRITSEC_COOKIE lock)
{
_ASSERTE(lock);
- UnsafeLeaveCriticalSection((CRITICAL_SECTION*)lock);
+ LeaveCriticalSection((CRITICAL_SECTION*)lock);
}
EVENT_COOKIE STDMETHODCALLTYPE UtilExecutionEngine::CreateAutoEvent(BOOL bInitialState)
{
- HANDLE handle = UnsafeCreateEvent(NULL, FALSE, bInitialState, NULL);
+ HANDLE handle = WszCreateEvent(NULL, FALSE, bInitialState, NULL);
_ASSERTE(handle);
return (EVENT_COOKIE)handle;
}
EVENT_COOKIE STDMETHODCALLTYPE UtilExecutionEngine::CreateManualEvent(BOOL bInitialState)
{
- HANDLE handle = UnsafeCreateEvent(NULL, TRUE, bInitialState, NULL);
+ HANDLE handle = WszCreateEvent(NULL, TRUE, bInitialState, NULL);
_ASSERTE(handle);
return (EVENT_COOKIE)handle;
}
BOOL STDMETHODCALLTYPE UtilExecutionEngine::ClrSetEvent(EVENT_COOKIE event)
{
_ASSERTE(event);
- return UnsafeSetEvent((HANDLE)event);
+ return SetEvent((HANDLE)event);
}
BOOL STDMETHODCALLTYPE UtilExecutionEngine::ClrResetEvent(EVENT_COOKIE event)
{
_ASSERTE(event);
- return UnsafeResetEvent((HANDLE)event);
+ return ResetEvent((HANDLE)event);
}
DWORD STDMETHODCALLTYPE UtilExecutionEngine::WaitForEvent(EVENT_COOKIE event, DWORD dwMilliseconds, BOOL bAlertable)
SEMAPHORE_COOKIE STDMETHODCALLTYPE UtilExecutionEngine::ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax)
{
- HANDLE handle = UnsafeCreateSemaphore(NULL, (LONG)dwInitial, (LONG)dwMax, NULL);
+ HANDLE handle = WszCreateSemaphore(NULL, (LONG)dwInitial, (LONG)dwMax, NULL);
_ASSERTE(handle);
return (SEMAPHORE_COOKIE)handle;
}
BOOL STDMETHODCALLTYPE UtilExecutionEngine::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount)
{
_ASSERTE(semaphore);
- return UnsafeReleaseSemaphore((HANDLE)semaphore, lReleaseCount, lpPreviousCount);
+ return ReleaseSemaphore((HANDLE)semaphore, lReleaseCount, lpPreviousCount);
}
MUTEX_COOKIE STDMETHODCALLTYPE UtilExecutionEngine::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
#include "volatile.h"
-// make all the unsafe redefinitions available
-#include "unsafe.h"
-
#include <../../debug/inc/dbgtargetcontext.h>
//-----------------------------------------------------------------------------------------------------------
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_CAN_TAKE_LOCK;
- UnsafeEnterCriticalSection(lpCriticalSection);
+ EnterCriticalSection(lpCriticalSection);
INCTHREADLOCKCOUNT();
}
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
- UnsafeLeaveCriticalSection(lpCriticalSection);
+ LeaveCriticalSection(lpCriticalSection);
DECTHREADLOCKCOUNT();
}
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_CAN_TAKE_LOCK;
- BOOL fEnteredCriticalSection = UnsafeTryEnterCriticalSection(lpCriticalSection);
+ BOOL fEnteredCriticalSection = TryEnterCriticalSection(lpCriticalSection);
if(fEnteredCriticalSection)
{
INCTHREADLOCKCOUNT();
}
{
- UnsafeInitializeCriticalSection(&m_criticalsection);
+ InitializeCriticalSection(&m_criticalsection);
}
SetFlags(flags);
GCPreemp __gcHolder((m_dwFlags & CRST_HOST_BREAKABLE) == CRST_HOST_BREAKABLE);
{
- UnsafeDeleteCriticalSection(&m_criticalsection);
+ DeleteCriticalSection(&m_criticalsection);
}
LOG((LF_SYNC, INFO3, "Deleting 0x%x\n", this));
}
}
- UnsafeEnterCriticalSection(&m_criticalsection);
+ EnterCriticalSection(&m_criticalsection);
#ifdef _DEBUG
PostEnter();
Thread * pThread = GetThread();
#endif
- UnsafeLeaveCriticalSection(&m_criticalsection);
+ LeaveCriticalSection(&m_criticalsection);
// Check for both rare case using one if-check
if (m_dwFlags & (CRST_TAKEN_DURING_SHUTDOWN | CRST_DEBUGGER_THREAD))
VOID * EEDbgInterfaceImpl::GetThreadDebuggerWord()
{
- return UnsafeTlsGetValue(g_debuggerWordTLSIndex);
+ return TlsGetValue(g_debuggerWordTLSIndex);
}
void EEDbgInterfaceImpl::SetThreadDebuggerWord(VOID *dw)
{
- UnsafeTlsSetValue(g_debuggerWordTLSIndex, dw);
+ TlsSetValue(g_debuggerWordTLSIndex, dw);
}
#endif
void CLRCriticalSection::Initialize()
{
WRAPPER_NO_CONTRACT;
- UnsafeInitializeCriticalSection(&m_cs);
+ InitializeCriticalSection(&m_cs);
}
// Destroy the critical section
void CLRCriticalSection::Destroy()
{
WRAPPER_NO_CONTRACT;
- UnsafeDeleteCriticalSection(&m_cs);
+ DeleteCriticalSection(&m_cs);
}
// Enter the critical section. Blocks until the section can be entered.
void CLRCriticalSection::Enter()
{
WRAPPER_NO_CONTRACT;
- UnsafeEnterCriticalSection(&m_cs);
+ EnterCriticalSection(&m_cs);
}
// Leave the critical section
void CLRCriticalSection::Leave()
{
WRAPPER_NO_CONTRACT;
- UnsafeLeaveCriticalSection(&m_cs);
+ LeaveCriticalSection(&m_cs);
}
// An implementatino of GCEvent that delegates to
#ifdef HAVE_GCCOVER // This is a debug only macro
if (GCStress<cfg_instr_jit>::IsEnabled())
{
- // UnsafeTlsGetValue trashes last error. When Complus_GCStress=4, GC is invoked
+ // TlsGetValue trashes last error. When Complus_GCStress=4, GC is invoked
// on every allowable JITed instruction by means of our exception handling machanism
// it is very easy to trash the last error. For example, a p/invoke called a native method
// which sets last error. Before we getting the last error in the IL stub, it is trashed here
SetAutoEvent();
{
- HANDLE h = UnsafeCreateEvent(NULL,FALSE,bInitialState,NULL);
+ HANDLE h = WszCreateEvent(NULL,FALSE,bInitialState,NULL);
if (h == NULL) {
ThrowOutOfMemory();
}
CONTRACTL_END;
{
- HANDLE h = UnsafeCreateEvent(NULL,TRUE,bInitialState,NULL);
+ HANDLE h = WszCreateEvent(NULL,TRUE,bInitialState,NULL);
if (h == NULL) {
ThrowOutOfMemory();
}
FastInterlockOr(&m_dwFlags, CLREVENT_FLAGS_AUTO_EVENT);
{
- HANDLE h = UnsafeCreateEvent(NULL,FALSE,FALSE,NULL);
+ HANDLE h = WszCreateEvent(NULL,FALSE,FALSE,NULL);
if (h == NULL) {
ThrowOutOfMemory();
}
SetOSEvent();
SetAutoEvent();
- HANDLE h = UnsafeCreateEvent(NULL,FALSE,bInitialState,NULL);
+ HANDLE h = WszCreateEvent(NULL,FALSE,bInitialState,NULL);
if (h == NULL) {
ThrowOutOfMemory();
}
SetOSEvent();
- HANDLE h = UnsafeCreateEvent(NULL,TRUE,bInitialState,NULL);
+ HANDLE h = WszCreateEvent(NULL,TRUE,bInitialState,NULL);
if (h == NULL) {
ThrowOutOfMemory();
}
_ASSERTE(Thread::Debug_AllowCallout());
{
- return UnsafeSetEvent(m_handle);
+ return SetEvent(m_handle);
}
}
!"Can not call Reset on AutoEvent");
{
- return UnsafeResetEvent(m_handle);
+ return ResetEvent(m_handle);
}
}
CONTRACTL_END;
{
- HANDLE h = UnsafeCreateSemaphore(NULL,dwInitial,dwMax,NULL);
+ HANDLE h = WszCreateSemaphore(NULL,dwInitial,dwMax,NULL);
if (h == NULL) {
ThrowOutOfMemory();
}
CONTRACTL_END;
{
- return ::UnsafeReleaseSemaphore(m_handle, lReleaseCount, lpPreviousCount);
+ return ::ReleaseSemaphore(m_handle, lReleaseCount, lpPreviousCount);
}
}
_ASSERTE(m_handle == nullptr);
#ifdef FEATURE_PAL
- HANDLE h = UnsafeCreateSemaphore(nullptr, 0, maximumSignalCount, nullptr);
+ HANDLE h = WszCreateSemaphore(nullptr, 0, maximumSignalCount, nullptr);
#else // !FEATURE_PAL
HANDLE h = CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, maximumSignalCount);
#endif // FEATURE_PAL
// Wake waiters
#ifdef FEATURE_PAL
- BOOL released = UnsafeReleaseSemaphore(m_handle, countOfWaitersToWake, nullptr);
+ BOOL released = ReleaseSemaphore(m_handle, countOfWaitersToWake, nullptr);
_ASSERTE(released);
#else // !FEATURE_PAL
while (--countOfWaitersToWake >= 0)
#ifdef FEATURE_INTEROP_DEBUGGING
// Ensure that debugger word slot is allocated
- UnsafeTlsSetValue(g_debuggerWordTLSIndex, 0);
+ TlsSetValue(g_debuggerWordTLSIndex, 0);
#endif
// We now have a Thread object visable to the RS. unmark special status.
#endif // !FEATURE_PAL
#ifdef FEATURE_INTEROP_DEBUGGING
- g_debuggerWordTLSIndex = UnsafeTlsAlloc();
+ g_debuggerWordTLSIndex = TlsAlloc();
if (g_debuggerWordTLSIndex == TLS_OUT_OF_INDEXES)
COMPlusThrowWin32();
#endif
#define SetupForComCallDWORDNoCheckCanRunManagedCode() \
InternalSetupForComCall(-1, -1, -1, false)
-#include "unsafe.h"
-
// A holder for NATIVE_LIBRARY_HANDLE.
FORCEINLINE void VoidFreeNativeLibrary(NATIVE_LIBRARY_HANDLE h)
{
}
else if (waitInfo->ExternalCompletionEvent != INVALID_HANDLE)
{
- UnsafeSetEvent(waitInfo->ExternalCompletionEvent);
+ SetEvent(waitInfo->ExternalCompletionEvent);
}
else if (waitInfo->ExternalEventSafeHandle != NULL)
{
if (timerInfo->ExternalCompletionEvent != INVALID_HANDLE)
{
- UnsafeSetEvent(timerInfo->ExternalCompletionEvent);
+ SetEvent(timerInfo->ExternalCompletionEvent);
timerInfo->ExternalCompletionEvent = INVALID_HANDLE;
}
HANDLE hEvent = refSH->GetHandle();
if (hEvent != INVALID_HANDLE_VALUE)
{
- UnsafeSetEvent(hEvent);
+ SetEvent(hEvent);
}
}
}