source: azure_iot_hub_f767zi/trunk/azure_iot_sdk/c-utility/inc/azure_c_shared_utility/condition.h@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 1.9 KB
Line 
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#ifndef CONDITION_H
5#define CONDITION_H
6
7#include "azure_macro_utils/macro_utils.h"
8#include "azure_c_shared_utility/lock.h"
9#include "umock_c/umock_c_prod.h"
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15typedef void* COND_HANDLE;
16
17#define COND_RESULT_VALUES \
18 COND_OK, \
19 COND_INVALID_ARG, \
20 COND_ERROR, \
21 COND_TIMEOUT \
22
23/**
24* @brief Enumeration specifying the lock status.
25*/
26MU_DEFINE_ENUM(COND_RESULT, COND_RESULT_VALUES);
27
28/**
29* @brief This API creates and returns a valid condition handle.
30*
31* @return A valid @c COND_HANDLE when successful or @c NULL otherwise.
32*/
33MOCKABLE_FUNCTION(, COND_HANDLE, Condition_Init);
34
35/**
36* @brief unblock all currently working condition.
37*
38* @param handle A valid handle to the lock.
39*
40* @return Returns @c COND_OK when the condition object has been
41* destroyed and @c COND_ERROR when an error occurs
42* and @c COND_TIMEOUT when the handle times out.
43*/
44MOCKABLE_FUNCTION(, COND_RESULT, Condition_Post, COND_HANDLE, handle);
45
46/**
47* @brief block on the condition handle unti the thread is signalled
48* or until the timeout_milliseconds is reached.
49*
50* @param handle A valid handle to the lock.
51*
52* @return Returns @c COND_OK when the condition object has been
53* destroyed and @c COND_ERROR when an error occurs
54* and @c COND_TIMEOUT when the handle times out.
55*/
56MOCKABLE_FUNCTION(, COND_RESULT, Condition_Wait, COND_HANDLE, handle, LOCK_HANDLE, lock, int, timeout_milliseconds);
57
58/**
59* @brief The condition instance is deinitialized.
60*
61* @param handle A valid handle to the condition.
62*
63* @return Returns @c COND_OK when the condition object has been
64* destroyed and @c COND_ERROR when an error occurs.
65*/
66MOCKABLE_FUNCTION(, void, Condition_Deinit, COND_HANDLE, handle);
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif /* CONDITION_H */
Note: See TracBrowser for help on using the repository browser.