test

Committer:
peyo
Date:
Wed Apr 12 14:07:09 2017 +0200
Revision:
0:cd5404401c2f
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
peyo 0:cd5404401c2f 1 /*
peyo 0:cd5404401c2f 2 * Copyright 2015-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
peyo 0:cd5404401c2f 3 *
peyo 0:cd5404401c2f 4 * Licensed under the Apache License, Version 2.0 (the "License").
peyo 0:cd5404401c2f 5 * You may not use this file except in compliance with the License.
peyo 0:cd5404401c2f 6 * A copy of the License is located at
peyo 0:cd5404401c2f 7 *
peyo 0:cd5404401c2f 8 * http://aws.amazon.com/apache2.0
peyo 0:cd5404401c2f 9 *
peyo 0:cd5404401c2f 10 * or in the "license" file accompanying this file. This file is distributed
peyo 0:cd5404401c2f 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
peyo 0:cd5404401c2f 12 * express or implied. See the License for the specific language governing
peyo 0:cd5404401c2f 13 * permissions and limitations under the License.
peyo 0:cd5404401c2f 14 */
peyo 0:cd5404401c2f 15
peyo 0:cd5404401c2f 16 /**
peyo 0:cd5404401c2f 17 * @file threads_interface.h
peyo 0:cd5404401c2f 18 * @brief Thread interface definition for MQTT client.
peyo 0:cd5404401c2f 19 *
peyo 0:cd5404401c2f 20 * Defines an interface that can be used by system components for multithreaded situations.
peyo 0:cd5404401c2f 21 * Starting point for porting the SDK to the threading hardware layer of a new platform.
peyo 0:cd5404401c2f 22 */
peyo 0:cd5404401c2f 23
peyo 0:cd5404401c2f 24 #include "aws_iot_config.h"
peyo 0:cd5404401c2f 25
peyo 0:cd5404401c2f 26 #ifdef _ENABLE_THREAD_SUPPORT_
peyo 0:cd5404401c2f 27 #ifndef __THREADS_INTERFACE_H_
peyo 0:cd5404401c2f 28 #define __THREADS_INTERFACE_H_
peyo 0:cd5404401c2f 29
peyo 0:cd5404401c2f 30 #ifdef __cplusplus
peyo 0:cd5404401c2f 31 extern "C" {
peyo 0:cd5404401c2f 32 #endif
peyo 0:cd5404401c2f 33
peyo 0:cd5404401c2f 34 /**
peyo 0:cd5404401c2f 35 * The platform specific timer header that defines the Timer struct
peyo 0:cd5404401c2f 36 */
peyo 0:cd5404401c2f 37 #include "threads_platform.h"
peyo 0:cd5404401c2f 38
peyo 0:cd5404401c2f 39 #include <aws_iot_error.h>
peyo 0:cd5404401c2f 40
peyo 0:cd5404401c2f 41 /**
peyo 0:cd5404401c2f 42 * @brief Mutex Type
peyo 0:cd5404401c2f 43 *
peyo 0:cd5404401c2f 44 * Forward declaration of a mutex struct. The definition of this struct is
peyo 0:cd5404401c2f 45 * platform dependent. When porting to a new platform add this definition
peyo 0:cd5404401c2f 46 * in "threads_platform.h".
peyo 0:cd5404401c2f 47 *
peyo 0:cd5404401c2f 48 */
peyo 0:cd5404401c2f 49 typedef struct _IoT_Mutex_t IoT_Mutex_t;
peyo 0:cd5404401c2f 50
peyo 0:cd5404401c2f 51 /**
peyo 0:cd5404401c2f 52 * @brief Initialize the provided mutex
peyo 0:cd5404401c2f 53 *
peyo 0:cd5404401c2f 54 * Call this function to initialize the mutex
peyo 0:cd5404401c2f 55 *
peyo 0:cd5404401c2f 56 * @param IoT_Mutex_t - pointer to the mutex to be initialized
peyo 0:cd5404401c2f 57 * @return IoT_Error_t - error code indicating result of operation
peyo 0:cd5404401c2f 58 */
peyo 0:cd5404401c2f 59 IoT_Error_t aws_iot_thread_mutex_init(IoT_Mutex_t *);
peyo 0:cd5404401c2f 60
peyo 0:cd5404401c2f 61 /**
peyo 0:cd5404401c2f 62 * @brief Lock the provided mutex
peyo 0:cd5404401c2f 63 *
peyo 0:cd5404401c2f 64 * Call this function to lock the mutex before performing a state change
peyo 0:cd5404401c2f 65 * This is a blocking call.
peyo 0:cd5404401c2f 66 *
peyo 0:cd5404401c2f 67 * @param IoT_Mutex_t - pointer to the mutex to be locked
peyo 0:cd5404401c2f 68 * @return IoT_Error_t - error code indicating result of operation
peyo 0:cd5404401c2f 69 */
peyo 0:cd5404401c2f 70 IoT_Error_t aws_iot_thread_mutex_lock(IoT_Mutex_t *);
peyo 0:cd5404401c2f 71
peyo 0:cd5404401c2f 72 /**
peyo 0:cd5404401c2f 73 * @brief Lock the provided mutex
peyo 0:cd5404401c2f 74 *
peyo 0:cd5404401c2f 75 * Call this function to lock the mutex before performing a state change.
peyo 0:cd5404401c2f 76 * This is not a blocking call.
peyo 0:cd5404401c2f 77 *
peyo 0:cd5404401c2f 78 * @param IoT_Mutex_t - pointer to the mutex to be locked
peyo 0:cd5404401c2f 79 * @return IoT_Error_t - error code indicating result of operation
peyo 0:cd5404401c2f 80 */
peyo 0:cd5404401c2f 81 IoT_Error_t aws_iot_thread_mutex_trylock(IoT_Mutex_t *);
peyo 0:cd5404401c2f 82
peyo 0:cd5404401c2f 83 /**
peyo 0:cd5404401c2f 84 * @brief Unlock the provided mutex
peyo 0:cd5404401c2f 85 *
peyo 0:cd5404401c2f 86 * Call this function to unlock the mutex before performing a state change
peyo 0:cd5404401c2f 87 *
peyo 0:cd5404401c2f 88 * @param IoT_Mutex_t - pointer to the mutex to be unlocked
peyo 0:cd5404401c2f 89 * @return IoT_Error_t - error code indicating result of operation
peyo 0:cd5404401c2f 90 */
peyo 0:cd5404401c2f 91 IoT_Error_t aws_iot_thread_mutex_unlock(IoT_Mutex_t *);
peyo 0:cd5404401c2f 92
peyo 0:cd5404401c2f 93 /**
peyo 0:cd5404401c2f 94 * @brief Destroy the provided mutex
peyo 0:cd5404401c2f 95 *
peyo 0:cd5404401c2f 96 * Call this function to destroy the mutex
peyo 0:cd5404401c2f 97 *
peyo 0:cd5404401c2f 98 * @param IoT_Mutex_t - pointer to the mutex to be destroyed
peyo 0:cd5404401c2f 99 * @return IoT_Error_t - error code indicating result of operation
peyo 0:cd5404401c2f 100 */
peyo 0:cd5404401c2f 101 IoT_Error_t aws_iot_thread_mutex_destroy(IoT_Mutex_t *);
peyo 0:cd5404401c2f 102
peyo 0:cd5404401c2f 103 #ifdef __cplusplus
peyo 0:cd5404401c2f 104 }
peyo 0:cd5404401c2f 105 #endif
peyo 0:cd5404401c2f 106
peyo 0:cd5404401c2f 107 #endif /*__THREADS_INTERFACE_H_*/
peyo 0:cd5404401c2f 108 #endif /*_ENABLE_THREAD_SUPPORT_*/