Azure IoT common library
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
condition_rtx_mbed.cpp@45:1119d0f2c4d8, 2018-06-11 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Mon Jun 11 15:41:10 2018 -0700
- Revision:
- 45:1119d0f2c4d8
- Parent:
- 19:2e0811512ceb
1.2.5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Azure.IoT Build | 0:fa2de1b79154 | 1 | // Copyright (c) Microsoft. All rights reserved. |
Azure.IoT Build | 0:fa2de1b79154 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
Azure.IoT Build | 0:fa2de1b79154 | 3 | |
Azure.IoT Build | 0:fa2de1b79154 | 4 | #include "azure_c_shared_utility/lock.h" |
Azure.IoT Build | 6:c55b013dfc2a | 5 | #include "azure_c_shared_utility/xlogging.h" |
Azure.IoT Build | 6:c55b013dfc2a | 6 | #include "azure_c_shared_utility/condition.h" |
Azure.IoT Build | 0:fa2de1b79154 | 7 | #include "rtos.h" |
Azure.IoT Build | 0:fa2de1b79154 | 8 | |
Azure.IoT Build | 0:fa2de1b79154 | 9 | COND_HANDLE Condition_Init(void) |
Azure.IoT Build | 0:fa2de1b79154 | 10 | { |
Azure.IoT Build | 0:fa2de1b79154 | 11 | return NULL; |
Azure.IoT Build | 0:fa2de1b79154 | 12 | } |
Azure.IoT Build | 0:fa2de1b79154 | 13 | |
Azure.IoT Build | 0:fa2de1b79154 | 14 | COND_RESULT Condition_Post(COND_HANDLE handle) |
Azure.IoT Build | 0:fa2de1b79154 | 15 | { |
Azure.IoT Build | 0:fa2de1b79154 | 16 | COND_RESULT result; |
Azure.IoT Build | 0:fa2de1b79154 | 17 | if (handle == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 18 | { |
Azure.IoT Build | 0:fa2de1b79154 | 19 | result = COND_INVALID_ARG; |
Azure.IoT Build | 0:fa2de1b79154 | 20 | } |
Azure.IoT Build | 0:fa2de1b79154 | 21 | else |
Azure.IoT Build | 0:fa2de1b79154 | 22 | { |
AzureIoTClient | 45:1119d0f2c4d8 | 23 | result = COND_ERROR; |
Azure.IoT Build | 0:fa2de1b79154 | 24 | } |
AzureIoTClient | 45:1119d0f2c4d8 | 25 | return result; |
Azure.IoT Build | 0:fa2de1b79154 | 26 | } |
Azure.IoT Build | 0:fa2de1b79154 | 27 | |
Azure.IoT Build | 0:fa2de1b79154 | 28 | COND_RESULT Condition_Wait(COND_HANDLE handle, LOCK_HANDLE lock, int timeout_milliseconds) |
Azure.IoT Build | 0:fa2de1b79154 | 29 | { |
Azure.IoT Build | 0:fa2de1b79154 | 30 | COND_RESULT result; |
Azure.IoT Build | 0:fa2de1b79154 | 31 | if (handle == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 32 | { |
Azure.IoT Build | 0:fa2de1b79154 | 33 | result = COND_INVALID_ARG; |
Azure.IoT Build | 0:fa2de1b79154 | 34 | } |
Azure.IoT Build | 0:fa2de1b79154 | 35 | else |
Azure.IoT Build | 0:fa2de1b79154 | 36 | { |
Azure.IoT Build | 0:fa2de1b79154 | 37 | result = COND_ERROR; |
Azure.IoT Build | 0:fa2de1b79154 | 38 | } |
Azure.IoT Build | 0:fa2de1b79154 | 39 | return result; |
Azure.IoT Build | 0:fa2de1b79154 | 40 | } |
Azure.IoT Build | 0:fa2de1b79154 | 41 | |
Azure.IoT Build | 0:fa2de1b79154 | 42 | void Condition_Deinit(COND_HANDLE handle) |
Azure.IoT Build | 0:fa2de1b79154 | 43 | { |
Azure.IoT Build | 0:fa2de1b79154 | 44 | if (handle != NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 45 | { |
Azure.IoT Build | 0:fa2de1b79154 | 46 | } |
Azure.IoT Build | 0:fa2de1b79154 | 47 | } |