main
h 52 lines 1.61 KB
Raw
1 #pragma once
2 // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #define ReleaseQueue(qh, pfn, pv) if (qh) { QueDestroy(qh, pfn, pv); }
10 #define ReleaseNullQue(qh, pfv, pv) if (qh) { QueDestroy(qh, pfn, pv); qh = NULL; }
11
12 typedef void* QUEUTIL_QUEUE_HANDLE;
13
14 typedef void(CALLBACK* PFNQUEUTIL_QUEUE_RELEASE_VALUE)(
15 __in void* pvValue,
16 __in void* pvContext
17 );
18
19 extern const int QUEUTIL_QUEUE_HANDLE_BYTES;
20
21 /********************************************************************
22 QueCreate - Creates a simple queue. It is not thread safe.
23
24 ********************************************************************/
25 HRESULT DAPI QueCreate(
26 __out_bcount(QUEUTIL_QUEUE_HANDLE_BYTES) QUEUTIL_QUEUE_HANDLE* phQueue
27 );
28
29 HRESULT DAPI QueEnqueue(
30 __in_bcount(QUEUTIL_QUEUE_HANDLE_BYTES) QUEUTIL_QUEUE_HANDLE hQueue,
31 __in void* pvValue
32 );
33
34 /********************************************************************
35 QueDequeue - Returns the value from the beginning of the queue,
36 or E_NOMOREITEMS if the queue is empty.
37
38 ********************************************************************/
39 HRESULT DAPI QueDequeue(
40 __in_bcount(QUEUTIL_QUEUE_HANDLE_BYTES) QUEUTIL_QUEUE_HANDLE hQueue,
41 __out void** ppvValue
42 );
43
44 void DAPI QueDestroy(
45 __in_bcount(QUEUTIL_QUEUE_HANDLE_BYTES) QUEUTIL_QUEUE_HANDLE hQueue,
46 __in_opt PFNQUEUTIL_QUEUE_RELEASE_VALUE pfnReleaseValue,
47 __in_opt void* pvContext
48 );
49
50 #ifdef __cplusplus
51 }
52 #endif