- in kernel32, replaced all {Enter|Leave}CriticalSection calls with

ntdll counterparts
- {Enter|Leave}CriticalSection is now a pure forward from kernel32 to
  ntdll (we now longer can use {Enter|Leave}CriticalSection in kernel32)
- replaced a few kernel32 heap management calls from ntdll, with
  RtlHeap* equivalents
This commit is contained in:
Eric Pouech 2003-06-23 18:12:28 +00:00 committed by Alexandre Julliard
parent 50c6965c78
commit c962a6997c
8 changed files with 92 additions and 100 deletions

View File

@ -1294,15 +1294,15 @@ BOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE func, BOOL add)
if (!ch) return FALSE;
ch->handler = func;
EnterCriticalSection(&CONSOLE_CritSect);
RtlEnterCriticalSection(&CONSOLE_CritSect);
ch->next = CONSOLE_Handlers;
CONSOLE_Handlers = ch;
LeaveCriticalSection(&CONSOLE_CritSect);
RtlLeaveCriticalSection(&CONSOLE_CritSect);
}
else
{
struct ConsoleHandler** ch;
EnterCriticalSection(&CONSOLE_CritSect);
RtlEnterCriticalSection(&CONSOLE_CritSect);
for (ch = &CONSOLE_Handlers; *ch; *ch = (*ch)->next)
{
if ((*ch)->handler == func) break;
@ -1329,7 +1329,7 @@ BOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE func, BOOL add)
WARN("Attempt to remove non-installed CtrlHandler %p\n", func);
ret = FALSE;
}
LeaveCriticalSection(&CONSOLE_CritSect);
RtlLeaveCriticalSection(&CONSOLE_CritSect);
}
return ret;
}
@ -1344,13 +1344,13 @@ static DWORD WINAPI CONSOLE_HandleCtrlCEntry(void* pmt)
{
struct ConsoleHandler* ch;
EnterCriticalSection(&CONSOLE_CritSect);
RtlEnterCriticalSection(&CONSOLE_CritSect);
/* the debugger didn't continue... so, pass to ctrl handlers */
for (ch = CONSOLE_Handlers; ch; ch = ch->next)
{
if (ch->handler((DWORD)pmt)) break;
}
LeaveCriticalSection(&CONSOLE_CritSect);
RtlLeaveCriticalSection(&CONSOLE_CritSect);
return 0;
}

View File

@ -60,12 +60,12 @@ static CRITICAL_SECTION ldt_section = CRITICAL_SECTION_INIT("ldt_section");
*/
static void ldt_lock(void)
{
EnterCriticalSection( &ldt_section );
RtlEnterCriticalSection( &ldt_section );
}
static void ldt_unlock(void)
{
LeaveCriticalSection( &ldt_section );
RtlLeaveCriticalSection( &ldt_section );
}

View File

@ -38,6 +38,8 @@
#include "winnt.h"
#include "thread.h"
#include "wine/debug.h"
#include "winternl.h"
#include "wine/server_protocol.h"
WINE_DEFAULT_DEBUG_CHANNEL(heap);
@ -587,7 +589,15 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
RtlInitializeCriticalSection( &heap->critSection );
if (flags & HEAP_SHARED)
MakeCriticalSectionGlobal( &heap->critSection ); /* FIXME: dll separation */
{
/* let's assume that only one thread at a time will try to do this */
HANDLE sem = heap->critSection.LockSemaphore;
if (!sem) NtCreateSemaphore( &sem, SEMAPHORE_ALL_ACCESS, NULL, 0, 1 );
NtDuplicateObject( GetCurrentProcess(), sem, GetCurrentProcess(), &sem, 0, 0,
DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS | DUP_HANDLE_CLOSE_SOURCE );
heap->critSection.LockSemaphore = sem;
}
}
/* Create the first free block */

View File

@ -1108,7 +1108,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
if (!pDefVal)
pDefVal = (LPWSTR)def_val;
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename )) {
if ((allow_section_name_copy) && (section == NULL))
@ -1121,7 +1121,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
ret = strlenW( buffer );
}
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
if (pDefVal != def_val) /* allocated */
HeapFree(GetProcessHeap(), 0, pDefVal);
@ -1371,13 +1371,13 @@ INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
{
int ret = 0;
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename ))
ret = PROFILE_GetSection(CurProfile->section, section, buffer, len,
FALSE, TRUE);
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
return ret;
}
@ -1465,7 +1465,7 @@ BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
{
BOOL ret = FALSE;
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename ))
{
@ -1485,7 +1485,7 @@ BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
}
}
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
return ret;
}
@ -1534,7 +1534,7 @@ BOOL WINAPI WritePrivateProfileSectionW( LPCWSTR section,
BOOL ret = FALSE;
LPWSTR p;
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename )) {
if (!section && !string)
@ -1559,7 +1559,7 @@ BOOL WINAPI WritePrivateProfileSectionW( LPCWSTR section,
}
}
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
return ret;
}
@ -1686,12 +1686,12 @@ DWORD WINAPI GetPrivateProfileSectionNamesW( LPWSTR buffer, DWORD size,
{
DWORD ret = 0;
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename ))
ret = PROFILE_GetSectionNames(buffer, size);
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
return ret;
}
@ -1746,7 +1746,7 @@ BOOL WINAPI GetPrivateProfileStructW (LPCWSTR section, LPCWSTR key,
{
BOOL ret = FALSE;
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename )) {
PROFILEKEY *k = PROFILE_Find ( &CurProfile->section, section, key, FALSE, FALSE);
@ -1806,7 +1806,7 @@ BOOL WINAPI GetPrivateProfileStructW (LPCWSTR section, LPCWSTR key,
}
}
}
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
return ret;
}
@ -1875,14 +1875,14 @@ BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key,
*p++ = hex[sum & 0xf];
*p++ = '\0';
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
if (PROFILE_Open( filename )) {
ret = PROFILE_SetString( section, key, outstring, FALSE);
PROFILE_FlushFile();
}
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
HeapFree( GetProcessHeap(), 0, outstring );
@ -1921,9 +1921,9 @@ BOOL WINAPI WritePrivateProfileStructA (LPCSTR section, LPCSTR key,
*/
void WINAPI WriteOutProfiles16(void)
{
EnterCriticalSection( &PROFILE_CritSect );
RtlEnterCriticalSection( &PROFILE_CritSect );
PROFILE_FlushFile();
LeaveCriticalSection( &PROFILE_CritSect );
RtlLeaveCriticalSection( &PROFILE_CritSect );
}
/***********************************************************************

View File

@ -107,6 +107,8 @@
#include "file.h"
#include "smb.h"
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/server.h"
#include "wine/debug.h"
@ -379,7 +381,7 @@ static BOOL NB_RecvData(int fd, struct NB_Buffer *rx)
rx->len = NBR_GETWORD(&buffer[2]);
rx->buffer = HeapAlloc(GetProcessHeap(), 0, rx->len);
rx->buffer = RtlAllocateHeap(ntdll_get_process_heap(), 0, rx->len);
if(!rx->buffer)
return FALSE;
@ -387,7 +389,7 @@ static BOOL NB_RecvData(int fd, struct NB_Buffer *rx)
if(rx->len!=r)
{
TRACE("Received %d bytes\n",r);
HeapFree(GetProcessHeap(), 0, rx->buffer);
RtlFreeHeap(ntdll_get_process_heap(), 0, rx->buffer);
rx->buffer = 0;
rx->len = 0;
return FALSE;
@ -556,11 +558,11 @@ static BOOL SMB_NegotiateProtocol(int fd, USHORT *dialect)
if(SMB_GetError(rx.buffer))
{
ERR("returned error\n");
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
return FALSE;
}
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
*dialect = 0;
@ -658,11 +660,11 @@ static BOOL SMB_SessionSetup(int fd, USHORT *userid)
*userid = SMB_GETWORD(&rx.buffer[SMB_USERID]);
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
return TRUE;
done:
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
return FALSE;
}
@ -716,13 +718,13 @@ static BOOL SMB_TreeConnect(int fd, USHORT user_id, LPCSTR share_name, USHORT *t
if(SMB_GetError(rx.buffer))
{
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
return FALSE;
}
*treeid = SMB_GETWORD(&rx.buffer[SMB_TREEID]);
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
TRACE("OK, treeid = %04x\n", *treeid);
return TRUE;
@ -955,7 +957,7 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
user_id, tree_id, file_id, count, offset);
buf_size = count+0x100;
tx.buffer = (unsigned char *) HeapAlloc(GetProcessHeap(),0,buf_size);
tx.buffer = (unsigned char *) RtlAllocateHeap(ntdll_get_process_heap(),0,buf_size);
memset(tx.buffer,0,buf_size);
@ -973,14 +975,14 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
rx.len = 0;
if(!NB_Transaction(fd, &tx, &rx))
{
HeapFree(GetProcessHeap(),0,tx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
return FALSE;
}
if(SMB_GetError(rx.buffer))
{
HeapFree(GetProcessHeap(),0,rx.buffer);
HeapFree(GetProcessHeap(),0,tx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
return FALSE;
}
@ -988,8 +990,8 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
if( (SMB_HDRSIZE+n*2) > rx.len )
{
HeapFree(GetProcessHeap(),0,rx.buffer);
HeapFree(GetProcessHeap(),0,tx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
ERR("Bad parameter count %d\n",n);
return FALSE;
}
@ -1008,8 +1010,8 @@ static BOOL SMB_Read(int fd, USHORT tree_id, USHORT user_id, USHORT dialect,
TRACE("Read %d bytes\n",n);
*read = n;
HeapFree(GetProcessHeap(),0,tx.buffer);
HeapFree(GetProcessHeap(),0,rx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,rx.buffer);
return TRUE;
}
@ -1051,7 +1053,7 @@ static BOOL SMB_Transaction2(int fd, int tree_id, int user_id,
BOOL ret = FALSE;
buf_size = 0x100 + send->setup_count*2 + send->param_count + send->data_count ;
tx.buffer = (unsigned char *) HeapAlloc(GetProcessHeap(),0,buf_size);
tx.buffer = (unsigned char *) RtlAllocateHeap(ntdll_get_process_heap(),0,buf_size);
tx.len = SMB_Header(tx.buffer, SMB_COM_TRANSACTION2, tree_id, user_id);
@ -1153,7 +1155,7 @@ static BOOL SMB_Transaction2(int fd, int tree_id, int user_id,
done:
if(tx.buffer)
HeapFree(GetProcessHeap(),0,tx.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,tx.buffer);
return ret;
}
@ -1170,15 +1172,15 @@ static BOOL SMB_SetupFindFirst(struct SMB_Trans2Info *send, LPSTR filename)
memset(send,0,sizeof(send));
send->setup_count = 1;
send->setup = HeapAlloc(GetProcessHeap(),0,send->setup_count*2);
send->setup = RtlAllocateHeap(ntdll_get_process_heap(),0,send->setup_count*2);
if(!send->setup)
return FALSE;
buf_size = 0x10 + lstrlenA(filename);
send->params = HeapAlloc(GetProcessHeap(),0,buf_size);
buf_size = 0x10 + strlen(filename);
send->params = RtlAllocateHeap(ntdll_get_process_heap(),0,buf_size);
if(!send->params)
{
HeapFree(GetProcessHeap(),0,send->setup);
RtlFreeHeap(ntdll_get_process_heap(),0,send->setup);
return FALSE;
}
@ -1193,7 +1195,7 @@ static BOOL SMB_SetupFindFirst(struct SMB_Trans2Info *send, LPSTR filename)
SMB_ADDDWORD(&send->params[len],storagetype); len += 4;
strcpy(&send->params[len],filename);
len += lstrlenA(filename)+1;
len += strlen(filename)+1;
send->param_count = len;
send->data = NULL;
@ -1219,8 +1221,8 @@ static SMB_DIR *SMB_Trans2FindFirst(int fd, USHORT tree_id,
memset(&recv,0,sizeof(recv));
ret = SMB_Transaction2(fd, tree_id, user_id, &send, &recv);
HeapFree(GetProcessHeap(),0,send.params);
HeapFree(GetProcessHeap(),0,send.setup);
RtlFreeHeap(ntdll_get_process_heap(),0,send.params);
RtlFreeHeap(ntdll_get_process_heap(),0,send.setup);
if(!ret)
goto done;
@ -1237,14 +1239,14 @@ static SMB_DIR *SMB_Trans2FindFirst(int fd, USHORT tree_id,
if(SMB_GETWORD(&recv.params[4]))
FIXME("need to read more!\n");
smbdir = HeapAlloc(GetProcessHeap(),0,sizeof(*smbdir));
smbdir = RtlAllocateHeap(ntdll_get_process_heap(),0,sizeof(*smbdir));
if(smbdir)
{
int i, ofs=0;
smbdir->current = 0;
smbdir->num_entries = num;
smbdir->entries = HeapAlloc(GetProcessHeap(), 0, sizeof(unsigned char*)*num);
smbdir->entries = RtlAllocateHeap(ntdll_get_process_heap(), 0, sizeof(unsigned char*)*num);
if(!smbdir->entries)
goto done;
smbdir->buffer = recv.buf.buffer; /* save to free later */
@ -1274,12 +1276,12 @@ done:
if(!ret)
{
if( recv.buf.buffer )
HeapFree(GetProcessHeap(),0,recv.buf.buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,recv.buf.buffer);
if( smbdir )
{
if( smbdir->entries )
HeapFree(GetProcessHeap(),0,smbdir->entries);
HeapFree(GetProcessHeap(),0,smbdir);
RtlFreeHeap(ntdll_get_process_heap(),0,smbdir->entries);
RtlFreeHeap(ntdll_get_process_heap(),0,smbdir);
}
smbdir = NULL;
}
@ -1346,14 +1348,14 @@ static BOOL SMB_LoginAndConnect(int fd, LPCSTR host, LPCSTR share, USHORT *tree_
if(!SMB_SessionSetup(fd, user_id))
return FALSE;
name = HeapAlloc(GetProcessHeap(),0,strlen(host)+strlen(share)+5);
name = RtlAllocateHeap(ntdll_get_process_heap(),0,strlen(host)+strlen(share)+5);
if(!name)
return FALSE;
sprintf(name,"\\\\%s\\%s",host,share);
if(!SMB_TreeConnect(fd,*user_id,name,tree_id))
{
HeapFree(GetProcessHeap(),0,name);
RtlFreeHeap(ntdll_get_process_heap(),0,name);
return FALSE;
}
@ -1399,7 +1401,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
INT len;
len = WideCharToMultiByte(CP_ACP, 0, uncname, -1, NULL, 0, NULL, NULL);
name = HeapAlloc(GetProcessHeap(), 0, len);
name = RtlAllocateHeap(ntdll_get_process_heap(), 0, len);
if(!name)
return handle;
@ -1407,7 +1409,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
if( !UNC_SplitName(name, &host, &share, &file) )
{
HeapFree(GetProcessHeap(),0,name);
RtlFreeHeap(ntdll_get_process_heap(),0,name);
return handle;
}
@ -1445,7 +1447,7 @@ HANDLE WINAPI SMB_CreateFileW( LPCWSTR uncname, DWORD access, DWORD sharing,
}
done:
HeapFree(GetProcessHeap(),0,name);
RtlFreeHeap(ntdll_get_process_heap(),0,name);
return handle;
}
@ -1555,7 +1557,7 @@ SMB_DIR* WINAPI SMB_FindFirst(LPCWSTR name)
TRACE("Find %s\n",debugstr_w(name));
len = WideCharToMultiByte( CP_ACP, 0, name, -1, NULL, 0, NULL, NULL );
filename = HeapAlloc(GetProcessHeap(),0,len);
filename = RtlAllocateHeap(ntdll_get_process_heap(),0,len);
if(!filename)
return ret;
WideCharToMultiByte( CP_ACP, 0, name, -1, filename, len, NULL, NULL );
@ -1580,7 +1582,7 @@ done:
close(fd);
if(filename)
HeapFree(GetProcessHeap(),0,filename);
RtlFreeHeap(ntdll_get_process_heap(),0,filename);
return ret;
}
@ -1630,9 +1632,9 @@ BOOL WINAPI SMB_FindNext(SMB_DIR *dir, WIN32_FIND_DATAW *data )
BOOL WINAPI SMB_CloseDir(SMB_DIR *dir)
{
HeapFree(GetProcessHeap(),0,dir->buffer);
HeapFree(GetProcessHeap(),0,dir->entries);
RtlFreeHeap(ntdll_get_process_heap(),0,dir->buffer);
RtlFreeHeap(ntdll_get_process_heap(),0,dir->entries);
memset(dir,0,sizeof(*dir));
HeapFree(GetProcessHeap(),0,dir);
RtlFreeHeap(ntdll_get_process_heap(),0,dir);
return TRUE;
}

View File

@ -260,23 +260,3 @@ SIZE_T WINAPI HeapSize( HANDLE heap, DWORD flags, LPVOID ptr )
{
return RtlSizeHeap( heap, flags, ptr );
}
void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
{
RtlEnterCriticalSection( crit );
}
BOOL WINAPI TryEnterCriticalSection( CRITICAL_SECTION *crit )
{
return RtlTryEnterCriticalSection( crit );
}
void WINAPI DeleteCriticalSection( CRITICAL_SECTION *crit )
{
RtlDeleteCriticalSection( crit );
}
void WINAPI LeaveCriticalSection( CRITICAL_SECTION *crit )
{
RtlLeaveCriticalSection( crit );
}

View File

@ -236,13 +236,13 @@ int __pthread_atfork(void (*prepare)(void),
void (*parent)(void),
void (*child)(void))
{
if (init_done) EnterCriticalSection( &atfork_section );
if (init_done) RtlEnterCriticalSection( &atfork_section );
assert( atfork_count < MAX_ATFORK );
atfork_prepare[atfork_count] = prepare;
atfork_parent[atfork_count] = parent;
atfork_child[atfork_count] = child;
atfork_count++;
if (init_done) LeaveCriticalSection( &atfork_section );
if (init_done) RtlLeaveCriticalSection( &atfork_section );
return 0;
}
strong_alias(__pthread_atfork, pthread_atfork);
@ -257,18 +257,18 @@ pid_t __fork(void)
libc_fork = dlsym( RTLD_NEXT, "fork" );
assert( libc_fork );
}
EnterCriticalSection( &atfork_section );
RtlEnterCriticalSection( &atfork_section );
/* prepare handlers are called in reverse insertion order */
for (i = atfork_count - 1; i >= 0; i--) if (atfork_prepare[i]) atfork_prepare[i]();
if (!(pid = libc_fork()))
{
InitializeCriticalSection( &atfork_section );
RtlInitializeCriticalSection( &atfork_section );
for (i = 0; i < atfork_count; i++) if (atfork_child[i]) atfork_child[i]();
}
else
{
for (i = 0; i < atfork_count; i++) if (atfork_parent[i]) atfork_parent[i]();
LeaveCriticalSection( &atfork_section );
RtlLeaveCriticalSection( &atfork_section );
}
return pid;
}
@ -293,11 +293,11 @@ strong_alias(__pthread_mutex_init, pthread_mutex_init);
static void mutex_real_init( pthread_mutex_t *mutex )
{
CRITICAL_SECTION *critsect = HeapAlloc(GetProcessHeap(), 0, sizeof(CRITICAL_SECTION));
InitializeCriticalSection(critsect);
RtlInitializeCriticalSection(critsect);
if (InterlockedCompareExchangePointer((void**)&(((wine_mutex)mutex)->critsect),critsect,NULL) != NULL) {
/* too late, some other thread already did it */
DeleteCriticalSection(critsect);
RtlDeleteCriticalSection(critsect);
HeapFree(GetProcessHeap(), 0, critsect);
}
}
@ -308,7 +308,7 @@ int __pthread_mutex_lock(pthread_mutex_t *mutex)
if (!((wine_mutex)mutex)->critsect)
mutex_real_init( mutex );
EnterCriticalSection(((wine_mutex)mutex)->critsect);
RtlEnterCriticalSection(((wine_mutex)mutex)->critsect);
return 0;
}
strong_alias(__pthread_mutex_lock, pthread_mutex_lock);
@ -319,7 +319,7 @@ int __pthread_mutex_trylock(pthread_mutex_t *mutex)
if (!((wine_mutex)mutex)->critsect)
mutex_real_init( mutex );
if (!TryEnterCriticalSection(((wine_mutex)mutex)->critsect)) {
if (!RtlTryEnterCriticalSection(((wine_mutex)mutex)->critsect)) {
errno = EBUSY;
return -1;
}
@ -330,7 +330,7 @@ strong_alias(__pthread_mutex_trylock, pthread_mutex_trylock);
int __pthread_mutex_unlock(pthread_mutex_t *mutex)
{
if (!((wine_mutex)mutex)->critsect) return 0;
LeaveCriticalSection(((wine_mutex)mutex)->critsect);
RtlLeaveCriticalSection(((wine_mutex)mutex)->critsect);
return 0;
}
strong_alias(__pthread_mutex_unlock, pthread_mutex_unlock);
@ -343,10 +343,10 @@ int __pthread_mutex_destroy(pthread_mutex_t *mutex)
return EBUSY;
#else
while (((wine_mutex)mutex)->critsect->RecursionCount)
LeaveCriticalSection(((wine_mutex)mutex)->critsect);
RtlLeaveCriticalSection(((wine_mutex)mutex)->critsect);
#endif
}
DeleteCriticalSection(((wine_mutex)mutex)->critsect);
RtlDeleteCriticalSection(((wine_mutex)mutex)->critsect);
HeapFree(GetProcessHeap(), 0, ((wine_mutex)mutex)->critsect);
return 0;
}

View File

@ -67,7 +67,7 @@ SEGPTR WINAPI GetpWin16Lock16(void)
*/
VOID WINAPI _CreateSysLevel(SYSLEVEL *lock, INT level)
{
InitializeCriticalSection( &lock->crst );
RtlInitializeCriticalSection( &lock->crst );
lock->level = level;
TRACE("(%p, %d): handle is %p\n",
@ -94,7 +94,7 @@ VOID WINAPI _EnterSysLevel(SYSLEVEL *lock)
lock, lock->level, teb->sys_mutex[i], i );
}
EnterCriticalSection( &lock->crst );
RtlEnterCriticalSection( &lock->crst );
teb->sys_count[lock->level]++;
teb->sys_mutex[lock->level] = lock;
@ -131,7 +131,7 @@ VOID WINAPI _LeaveSysLevel(SYSLEVEL *lock)
teb->sys_mutex[lock->level] = NULL;
}
LeaveCriticalSection( &lock->crst );
RtlLeaveCriticalSection( &lock->crst );
TRACE("(%p, level %d): thread %lx (fs %04x, pid %ld) count after %ld\n",
lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(),