Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / common / src / camutex_noop.c
1 //******************************************************************
2 //
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 //
21 //
22 //*********************************************************************
23
24 /**
25  * @file
26  * This file provides APIs related to mutex with no operation
27  * for Singlethread implementation.
28  */
29
30 #include "camutex.h"
31
32 /**
33  * TAG
34  * Logging tag for module name
35  */
36 #define TAG "UMUTEX"
37
38 typedef struct _tagMutexInfo_t
39 {
40 } ca_mutex_internal;
41
42 typedef struct _tagEventInfo_t
43 {
44 } ca_cond_internal;
45
46 /**
47  * @var g_mutexInfo
48  * @brief This is used to return a non NULL value for ca_mutex_new().
49  */
50 static ca_mutex_internal g_mutexInfo = { 0 };
51
52 /**
53  * @var g_condInfo
54  * @brief This is used to return a non NULL value for ca_cond_new().
55  */
56 static ca_cond_internal g_condInfo = { 0 };
57
58 ca_mutex ca_mutex_new(void)
59 {
60     return &g_mutexInfo;
61 }
62
63 bool ca_mutex_free(ca_mutex mutex)
64 {
65     return true;
66 }
67
68 void ca_mutex_lock(ca_mutex mutex)
69 {
70     return;
71 }
72
73 bool ca_mutex_trylock(ca_mutex mutex)
74 {
75     return true;
76 }
77
78 void ca_mutex_unlock(ca_mutex mutex)
79 {
80     return;
81 }
82
83 ca_cond ca_cond_new(void)
84 {
85     return &g_condInfo;
86 }
87
88 void ca_cond_free(ca_cond cond)
89 {
90     return;
91 }
92
93 void ca_cond_signal(ca_cond cond)
94 {
95     return;
96 }
97
98 void ca_cond_broadcast(ca_cond cond)
99 {
100     return;
101 }
102
103 void ca_cond_wait(ca_cond cond, ca_mutex mutex)
104 {
105     return;
106 }
107
108 CAWaitResult_t ca_cond_wait_for(ca_cond cond, ca_mutex mutex, uint64_t microseconds)
109 {
110     return CA_WAIT_SUCCESS;
111 }
112