FreeRDP
|
#include <winpr/config.h>
#include <winpr/crt.h>
#include <winpr/file.h>
#include <winpr/assert.h>
#include <winpr/sysinfo.h>
#include <winpr/synch.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <signal.h>
#include "event.h"
#include "synch.h"
#include "../handle/handle.h"
#include "../thread/thread.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 void | TimerPostDelete_APC (LPVOID arg) |
static int | InitializeWaitableTimer (WINPR_TIMER *timer) |
static BOOL | timer_drain_fd (int fd) |
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) |
static void | timerAPC (LPVOID arg) |
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) |
int | GetTimerFileDescriptor (HANDLE hTimer) |
static void | timespec_add_ms (struct timespec *tspec, UINT32 ms) |
static void | timespec_gettimeofday (struct timespec *tspec) |
static INT64 | 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 void * | TimerQueueThread (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 |
#define TAG WINPR_TAG("synch.timer") |
WinPR: Windows Portable Runtime Synchronization Functions
Copyright 2012 Marc-Andre Moreau marca Copyright 2021 David Fort ndre .more au@g mail. comconta ct@h arden ing- consu ltin g.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.
BOOL CancelWaitableTimer | ( | HANDLE | hTimer | ) |
BOOL ChangeTimerQueueTimer | ( | HANDLE | TimerQueue, |
HANDLE | Timer, | ||
ULONG | DueTime, | ||
ULONG | Period | ||
) |
HANDLE CreateTimerQueue | ( | void | ) |
BOOL CreateTimerQueueTimer | ( | PHANDLE | phNewTimer, |
HANDLE | TimerQueue, | ||
WAITORTIMERCALLBACK | Callback, | ||
PVOID | Parameter, | ||
DWORD | DueTime, | ||
DWORD | Period, | ||
ULONG | Flags | ||
) |
HANDLE CreateWaitableTimerA | ( | LPSECURITY_ATTRIBUTES | lpTimerAttributes, |
BOOL | bManualReset, | ||
LPCSTR | lpTimerName | ||
) |
Waitable Timer
HANDLE CreateWaitableTimerExA | ( | LPSECURITY_ATTRIBUTES | lpTimerAttributes, |
LPCSTR | lpTimerName, | ||
DWORD | dwFlags, | ||
DWORD | dwDesiredAccess | ||
) |
HANDLE CreateWaitableTimerExW | ( | LPSECURITY_ATTRIBUTES | lpTimerAttributes, |
LPCWSTR | lpTimerName, | ||
DWORD | dwFlags, | ||
DWORD | dwDesiredAccess | ||
) |
HANDLE CreateWaitableTimerW | ( | LPSECURITY_ATTRIBUTES | lpTimerAttributes, |
BOOL | bManualReset, | ||
LPCWSTR | lpTimerName | ||
) |
BOOL DeleteTimerQueue | ( | HANDLE | TimerQueue | ) |
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)
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)
|
static |
int GetTimerFileDescriptor | ( | HANDLE | hTimer | ) |
|
static |
|
static |
HANDLE OpenWaitableTimerA | ( | DWORD | dwDesiredAccess, |
BOOL | bInheritHandle, | ||
LPCSTR | lpTimerName | ||
) |
HANDLE OpenWaitableTimerW | ( | DWORD | dwDesiredAccess, |
BOOL | bInheritHandle, | ||
LPCWSTR | lpTimerName | ||
) |
|
static |
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 | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Timer-Queue Timer Design, Performance, and Optimization of Timer Strategies for Real-time ORBs: http://www.cs.wustl.edu/~schmidt/Timer_Queue.html
|
static |
|
static |
|
static |