FreeRDP
critical.c File Reference
#include <winpr/config.h>
#include <winpr/assert.h>
#include <winpr/tchar.h>
#include <winpr/synch.h>
#include <winpr/sysinfo.h>
#include <winpr/interlocked.h>
#include <winpr/thread.h>
#include "synch.h"
#include "../log.h"

Macros

#define TAG   WINPR_TAG("synch.critical")
 

Functions

VOID InitializeCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 
BOOL InitializeCriticalSectionEx (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags)
 
BOOL InitializeCriticalSectionAndSpinCount (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount)
 
DWORD SetCriticalSectionSpinCount (LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount)
 
static VOID _WaitForCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 
static VOID _UnWaitCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 
VOID EnterCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 
BOOL TryEnterCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 
VOID LeaveCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 
VOID DeleteCriticalSection (LPCRITICAL_SECTION lpCriticalSection)
 

Macro Definition Documentation

◆ TAG

#define TAG   WINPR_TAG("synch.critical")

WinPR: Windows Portable Runtime Synchronization Functions

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2013 Norbert Federa norbe.nosp@m.rt.f.nosp@m.edera.nosp@m.@thi.nosp@m.ncast.nosp@m..com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ _UnWaitCriticalSection()

static VOID _UnWaitCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)
static
Here is the caller graph for this function:

◆ _WaitForCriticalSection()

static VOID _WaitForCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)
static
Here is the caller graph for this function:

◆ DeleteCriticalSection()

VOID DeleteCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnterCriticalSection()

VOID EnterCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)

On some operating systems sched_yield is a stub. usleep should at least trigger a context switch if any thread is waiting. A ThreadYield() would be nice in winpr ...

Here is the call graph for this function:

◆ InitializeCriticalSection()

VOID InitializeCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeCriticalSectionAndSpinCount()

BOOL InitializeCriticalSectionAndSpinCount ( LPCRITICAL_SECTION  lpCriticalSection,
DWORD  dwSpinCount 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeCriticalSectionEx()

BOOL InitializeCriticalSectionEx ( LPCRITICAL_SECTION  lpCriticalSection,
DWORD  dwSpinCount,
DWORD  Flags 
)

See http://msdn.microsoft.com/en-us/library/ff541979(v=vs.85).aspx

  • The LockCount field indicates the number of times that any thread has called the EnterCriticalSection routine for this critical section, minus one. This field starts at -1 for an unlocked critical section. Each call of EnterCriticalSection increments this value; each call of LeaveCriticalSection decrements it.
  • The RecursionCount field indicates the number of times that the owning thread has called EnterCriticalSection for this critical section.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LeaveCriticalSection()

VOID LeaveCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)
Here is the call graph for this function:

◆ SetCriticalSectionSpinCount()

DWORD SetCriticalSectionSpinCount ( LPCRITICAL_SECTION  lpCriticalSection,
DWORD  dwSpinCount 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TryEnterCriticalSection()

BOOL TryEnterCriticalSection ( LPCRITICAL_SECTION  lpCriticalSection)
Here is the call graph for this function:
Here is the caller graph for this function: