ReactOS 0.4.15-dev-5863-g1fe3ab7
lock.c File Reference
#include <precomp.h>
Include dependency graph for lock.c:

Go to the source code of this file.

Classes

struct  LOCKTABLEENTRY
 

Functions

static __inline void msvcrt_mlock_set_entry_initialized (int locknum, BOOL initialized)
 
static __inline void msvcrt_initialize_mlock (int locknum)
 
static __inline void msvcrt_uninitialize_mlock (int locknum)
 
void msvcrt_init_mt_locks (void)
 
void msvcrt_free_mt_locks (void)
 
void _lock (int locknum)
 
void _unlock (int locknum)
 

Variables

static LOCKTABLEENTRY lock_table [_TOTAL_LOCKS]
 

Function Documentation

◆ _lock()

void _lock ( int  locknum)

Definition at line 97 of file lock.c.

98{
99 TRACE( "(%d)\n", locknum );
100
101 /* If the lock doesn't exist yet, create it */
102 if( lock_table[ locknum ].bInit == FALSE )
103 {
104 /* Lock while we're changing the lock table */
106
107 /* Check again if we've got a bit of a race on lock creation */
108 if( lock_table[ locknum ].bInit == FALSE )
109 {
110 TRACE( ": creating lock #%d\n", locknum );
111 msvcrt_initialize_mlock( locknum );
112 }
113
114 /* Unlock ourselves */
116 }
117
118 EnterCriticalSection( &(lock_table[ locknum ].crit) );
119}
#define FALSE
Definition: types.h:117
#define _LOCKTAB_LOCK
Definition: mtdll.h:54
static __inline void msvcrt_initialize_mlock(int locknum)
Definition: lock.c:35
static LOCKTABLEENTRY lock_table[_TOTAL_LOCKS]
Definition: lock.c:28
void _unlock(int locknum)
Definition: lock.c:126
void _lock(int locknum)
Definition: lock.c:97
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by _lock(), _lock_file(), and _onexit().

◆ _unlock()

void _unlock ( int  locknum)

Definition at line 126 of file lock.c.

127{
128 TRACE( "(%d)\n", locknum );
129
130 LeaveCriticalSection( &(lock_table[ locknum ].crit) );
131}
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by _lock(), _onexit(), and _unlock_file().

◆ msvcrt_free_mt_locks()

void msvcrt_free_mt_locks ( void  )

Definition at line 77 of file lock.c.

78{
79 int i;
80
81 TRACE(": uninitializing all mtlocks\n" );
82
83 /* Uninitialize the table */
84 for( i=0; i < _TOTAL_LOCKS; i++ )
85 {
86 if( lock_table[ i ].bInit )
87 {
89 }
90 }
91}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _TOTAL_LOCKS
Definition: mtdll.h:70
static __inline void msvcrt_uninitialize_mlock(int locknum)
Definition: lock.c:41

Referenced by DllMain().

◆ msvcrt_init_mt_locks()

void msvcrt_init_mt_locks ( void  )

Definition at line 54 of file lock.c.

55{
56 int i;
57
58 TRACE( "initializing mtlocks\n" );
59
60 /* Initialize the table */
61 for( i=0; i < _TOTAL_LOCKS; i++ )
62 {
64 }
65
66 /* Initialize our lock table lock */
68}
static __inline void msvcrt_mlock_set_entry_initialized(int locknum, BOOL initialized)
Definition: lock.c:30

Referenced by crt_process_init(), and DllMain().

◆ msvcrt_initialize_mlock()

static __inline void msvcrt_initialize_mlock ( int  locknum)
static

Definition at line 35 of file lock.c.

36{
37 InitializeCriticalSection( &(lock_table[ locknum ].crit) );
39}
#define TRUE
Definition: types.h:120
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751

Referenced by _lock(), and msvcrt_init_mt_locks().

◆ msvcrt_mlock_set_entry_initialized()

static __inline void msvcrt_mlock_set_entry_initialized ( int  locknum,
BOOL  initialized 
)
static

Definition at line 30 of file lock.c.

31{
32 lock_table[ locknum ].bInit = initialized;
33}
BOOL bInit
Definition: lock.c:24
static BOOL initialized
Definition: syslog.c:39

Referenced by msvcrt_init_mt_locks(), msvcrt_initialize_mlock(), and msvcrt_uninitialize_mlock().

◆ msvcrt_uninitialize_mlock()

static __inline void msvcrt_uninitialize_mlock ( int  locknum)
static

Definition at line 41 of file lock.c.

42{
43 DeleteCriticalSection( &(lock_table[ locknum ].crit) );
45}
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by msvcrt_free_mt_locks().

Variable Documentation

◆ lock_table