Azure IoT common library
Fork of azure_c_shared_utility by
condition_rtx_mbed.cpp@19:2e0811512ceb, 2017-01-28 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Sat Jan 28 09:35:22 2017 -0800
- Revision:
- 19:2e0811512ceb
- Parent:
- 6:c55b013dfc2a
1.1.6
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 | { |
Azure.IoT Build | 0:fa2de1b79154 | 23 | |
Azure.IoT Build | 0:fa2de1b79154 | 24 | } |
Azure.IoT Build | 0:fa2de1b79154 | 25 | return COND_ERROR; |
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 | } |