Azure IoT common library
Fork of azure_c_shared_utility by
condition_rtx_mbed.cpp@0:fa2de1b79154, 2016-04-08 (annotated)
- Committer:
- Azure.IoT Build
- Date:
- Fri Apr 08 12:01:36 2016 -0700
- Revision:
- 0:fa2de1b79154
- Child:
- 6:c55b013dfc2a
1.0.4
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 <cstdlib> |
Azure.IoT Build | 0:fa2de1b79154 | 5 | #ifdef _CRTDBG_MAP_ALLOC |
Azure.IoT Build | 0:fa2de1b79154 | 6 | #include <crtdbg.h> |
Azure.IoT Build | 0:fa2de1b79154 | 7 | #endif |
Azure.IoT Build | 0:fa2de1b79154 | 8 | |
Azure.IoT Build | 0:fa2de1b79154 | 9 | #include "azure_c_shared_utility/lock.h" |
Azure.IoT Build | 0:fa2de1b79154 | 10 | #include "azure_c_shared_utility/iot_logging.h" |
Azure.IoT Build | 0:fa2de1b79154 | 11 | #include "rtos.h" |
Azure.IoT Build | 0:fa2de1b79154 | 12 | #include "azure_c_shared_utility/condition.h" |
Azure.IoT Build | 0:fa2de1b79154 | 13 | |
Azure.IoT Build | 0:fa2de1b79154 | 14 | COND_HANDLE Condition_Init(void) |
Azure.IoT Build | 0:fa2de1b79154 | 15 | { |
Azure.IoT Build | 0:fa2de1b79154 | 16 | return NULL; |
Azure.IoT Build | 0:fa2de1b79154 | 17 | } |
Azure.IoT Build | 0:fa2de1b79154 | 18 | |
Azure.IoT Build | 0:fa2de1b79154 | 19 | COND_RESULT Condition_Post(COND_HANDLE handle) |
Azure.IoT Build | 0:fa2de1b79154 | 20 | { |
Azure.IoT Build | 0:fa2de1b79154 | 21 | COND_RESULT result; |
Azure.IoT Build | 0:fa2de1b79154 | 22 | if (handle == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 23 | { |
Azure.IoT Build | 0:fa2de1b79154 | 24 | result = COND_INVALID_ARG; |
Azure.IoT Build | 0:fa2de1b79154 | 25 | } |
Azure.IoT Build | 0:fa2de1b79154 | 26 | else |
Azure.IoT Build | 0:fa2de1b79154 | 27 | { |
Azure.IoT Build | 0:fa2de1b79154 | 28 | |
Azure.IoT Build | 0:fa2de1b79154 | 29 | } |
Azure.IoT Build | 0:fa2de1b79154 | 30 | return COND_ERROR; |
Azure.IoT Build | 0:fa2de1b79154 | 31 | } |
Azure.IoT Build | 0:fa2de1b79154 | 32 | |
Azure.IoT Build | 0:fa2de1b79154 | 33 | COND_RESULT Condition_Wait(COND_HANDLE handle, LOCK_HANDLE lock, int timeout_milliseconds) |
Azure.IoT Build | 0:fa2de1b79154 | 34 | { |
Azure.IoT Build | 0:fa2de1b79154 | 35 | COND_RESULT result; |
Azure.IoT Build | 0:fa2de1b79154 | 36 | if (handle == NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 37 | { |
Azure.IoT Build | 0:fa2de1b79154 | 38 | result = COND_INVALID_ARG; |
Azure.IoT Build | 0:fa2de1b79154 | 39 | } |
Azure.IoT Build | 0:fa2de1b79154 | 40 | else |
Azure.IoT Build | 0:fa2de1b79154 | 41 | { |
Azure.IoT Build | 0:fa2de1b79154 | 42 | result = COND_ERROR; |
Azure.IoT Build | 0:fa2de1b79154 | 43 | } |
Azure.IoT Build | 0:fa2de1b79154 | 44 | return result; |
Azure.IoT Build | 0:fa2de1b79154 | 45 | } |
Azure.IoT Build | 0:fa2de1b79154 | 46 | |
Azure.IoT Build | 0:fa2de1b79154 | 47 | void Condition_Deinit(COND_HANDLE handle) |
Azure.IoT Build | 0:fa2de1b79154 | 48 | { |
Azure.IoT Build | 0:fa2de1b79154 | 49 | if (handle != NULL) |
Azure.IoT Build | 0:fa2de1b79154 | 50 | { |
Azure.IoT Build | 0:fa2de1b79154 | 51 | } |
Azure.IoT Build | 0:fa2de1b79154 | 52 | } |