FreeRDP
synch/timer.c File Reference
#include <winpr/crt.h>
#include <winpr/file.h>
#include <winpr/sysinfo.h>
#include <winpr/synch.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <signal.h>
#include "synch.h"
#include "../handle/handle.h"
#include "../log.h"

Macros

#define TAG   WINPR_TAG("synch.timer")
 

Functions

static BOOL TimerCloseHandle (HANDLE handle)
 
static BOOL TimerIsHandled (HANDLE handle)
 
static int TimerGetFd (HANDLE handle)
 
static DWORD TimerCleanupHandle (HANDLE handle)
 
static int InitializeWaitableTimer (WINPR_TIMER *timer)
 
HANDLE CreateWaitableTimerA (LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName)
 
HANDLE CreateWaitableTimerW (LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName)
 
HANDLE CreateWaitableTimerExA (LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess)
 
HANDLE CreateWaitableTimerExW (LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess)
 
BOOL SetWaitableTimer (HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume)
 
BOOL SetWaitableTimerEx (HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay)
 
HANDLE OpenWaitableTimerA (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpTimerName)
 
HANDLE OpenWaitableTimerW (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpTimerName)
 
BOOL CancelWaitableTimer (HANDLE hTimer)
 
static void timespec_add_ms (struct timespec *tspec, UINT32 ms)
 
static UINT64 timespec_to_ms (struct timespec *tspec)
 
static void timespec_gettimeofday (struct timespec *tspec)
 
static int timespec_compare (const struct timespec *tspec1, const struct timespec *tspec2)
 
static void timespec_copy (struct timespec *dst, struct timespec *src)
 
static void InsertTimerQueueTimer (WINPR_TIMER_QUEUE_TIMER **pHead, WINPR_TIMER_QUEUE_TIMER *timer)
 
static void RemoveTimerQueueTimer (WINPR_TIMER_QUEUE_TIMER **pHead, WINPR_TIMER_QUEUE_TIMER *timer)
 
static int FireExpiredTimerQueueTimers (WINPR_TIMER_QUEUE *timerQueue)
 
static voidTimerQueueThread (void *arg)
 
static int StartTimerQueueThread (WINPR_TIMER_QUEUE *timerQueue)
 
HANDLE CreateTimerQueue (void)
 
BOOL DeleteTimerQueueEx (HANDLE TimerQueue, HANDLE CompletionEvent)
 
BOOL DeleteTimerQueue (HANDLE TimerQueue)
 
BOOL CreateTimerQueueTimer (PHANDLE phNewTimer, HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags)
 
BOOL ChangeTimerQueueTimer (HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period)
 
BOOL DeleteTimerQueueTimer (HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent)
 

Variables

static HANDLE_OPS ops
 

Macro Definition Documentation

#define TAG   WINPR_TAG("synch.timer")

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

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

BOOL CancelWaitableTimer ( HANDLE  hTimer)

Here is the call graph for this function:

BOOL ChangeTimerQueueTimer ( HANDLE  TimerQueue,
HANDLE  Timer,
ULONG  DueTime,
ULONG  Period 
)

Here is the call graph for this function:

HANDLE CreateTimerQueue ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CreateTimerQueueTimer ( PHANDLE  phNewTimer,
HANDLE  TimerQueue,
WAITORTIMERCALLBACK  Callback,
PVOID  Parameter,
DWORD  DueTime,
DWORD  Period,
ULONG  Flags 
)

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE CreateWaitableTimerA ( LPSECURITY_ATTRIBUTES  lpTimerAttributes,
BOOL  bManualReset,
LPCSTR  lpTimerName 
)

Waitable Timer

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE CreateWaitableTimerExA ( LPSECURITY_ATTRIBUTES  lpTimerAttributes,
LPCSTR  lpTimerName,
DWORD  dwFlags,
DWORD  dwDesiredAccess 
)

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE CreateWaitableTimerExW ( LPSECURITY_ATTRIBUTES  lpTimerAttributes,
LPCWSTR  lpTimerName,
DWORD  dwFlags,
DWORD  dwDesiredAccess 
)

Here is the call graph for this function:

HANDLE CreateWaitableTimerW ( LPSECURITY_ATTRIBUTES  lpTimerAttributes,
BOOL  bManualReset,
LPCWSTR  lpTimerName 
)

Here is the call graph for this function:

BOOL DeleteTimerQueue ( HANDLE  TimerQueue)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL DeleteTimerQueueEx ( HANDLE  TimerQueue,
HANDLE  CompletionEvent 
)

Quote from MSDN regarding CompletionEvent: If this parameter is INVALID_HANDLE_VALUE, the function waits for all callback functions to complete before returning. If this parameter is NULL, the function marks the timer for deletion and returns immediately.

Note: The current WinPR implementation implicitly waits for any callback functions to complete (see pthread_join above)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL DeleteTimerQueueTimer ( HANDLE  TimerQueue,
HANDLE  Timer,
HANDLE  CompletionEvent 
)

Quote from MSDN regarding CompletionEvent: If this parameter is INVALID_HANDLE_VALUE, the function waits for all callback functions to complete before returning. If this parameter is NULL, the function marks the timer for deletion and returns immediately.

Note: The current WinPR implementation implicitly waits for any callback functions to complete (see cond_mutex usage)

Here is the call graph for this function:

Here is the caller graph for this function:

static int FireExpiredTimerQueueTimers ( WINPR_TIMER_QUEUE *  timerQueue)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int InitializeWaitableTimer ( WINPR_TIMER *  timer)
static

Here is the caller graph for this function:

static void InsertTimerQueueTimer ( WINPR_TIMER_QUEUE_TIMER **  pHead,
WINPR_TIMER_QUEUE_TIMER *  timer 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE OpenWaitableTimerA ( DWORD  dwDesiredAccess,
BOOL  bInheritHandle,
LPCSTR  lpTimerName 
)
HANDLE OpenWaitableTimerW ( DWORD  dwDesiredAccess,
BOOL  bInheritHandle,
LPCWSTR  lpTimerName 
)
static void RemoveTimerQueueTimer ( WINPR_TIMER_QUEUE_TIMER **  pHead,
WINPR_TIMER_QUEUE_TIMER *  timer 
)
static

Here is the caller graph for this function:

BOOL SetWaitableTimer ( HANDLE  hTimer,
const LARGE_INTEGER *  lpDueTime,
LONG  lPeriod,
PTIMERAPCROUTINE  pfnCompletionRoutine,
LPVOID  lpArgToCompletionRoutine,
BOOL  fResume 
)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL SetWaitableTimerEx ( HANDLE  hTimer,
const LARGE_INTEGER *  lpDueTime,
LONG  lPeriod,
PTIMERAPCROUTINE  pfnCompletionRoutine,
LPVOID  lpArgToCompletionRoutine,
PREASON_CONTEXT  WakeContext,
ULONG  TolerableDelay 
)

Here is the call graph for this function:

static int StartTimerQueueThread ( WINPR_TIMER_QUEUE *  timerQueue)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static DWORD TimerCleanupHandle ( HANDLE  handle)
static

Here is the call graph for this function:

BOOL TimerCloseHandle ( HANDLE  handle)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int TimerGetFd ( HANDLE  handle)
static

Here is the call graph for this function:

static BOOL TimerIsHandled ( HANDLE  handle)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void* TimerQueueThread ( void arg)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void timespec_add_ms ( struct timespec *  tspec,
UINT32  ms 
)
static

Timer-Queue Timer Design, Performance, and Optimization of Timer Strategies for Real-time ORBs: http://www.cs.wustl.edu/~schmidt/Timer_Queue.html

Here is the caller graph for this function:

static int timespec_compare ( const struct timespec *  tspec1,
const struct timespec *  tspec2 
)
static

Here is the caller graph for this function:

static void timespec_copy ( struct timespec *  dst,
struct timespec *  src 
)
static

Here is the caller graph for this function:

static void timespec_gettimeofday ( struct timespec *  tspec)
static

Here is the caller graph for this function:

static UINT64 timespec_to_ms ( struct timespec *  tspec)
static

Variable Documentation

HANDLE_OPS ops
static
Initial value:
=
{
NULL
}
static int TimerGetFd(HANDLE handle)
Definition: synch/timer.c:61
static DWORD TimerCleanupHandle(HANDLE handle)
Definition: synch/timer.c:71
if availableBytes return NULL
Definition: TPCircularBuffer.h:104
static BOOL TimerIsHandled(HANDLE handle)
Definition: synch/timer.c:48
static BOOL TimerCloseHandle(HANDLE handle)
Definition: synch/timer.c:112