replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / c_common / octhread / src / noop / octhread.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 #include "octhread.h"
30
31 /**
32  * TAG
33  * Logging tag for module name
34  */
35 #define TAG "UMUTEX"
36
37 typedef struct _tagMutexInfo_t
38 {
39 } oc_mutex_internal;
40
41 typedef struct _tagEventInfo_t
42 {
43 } oc_cond_internal;
44
45 typedef struct _tagThreadInfo_t
46 {
47 } oc_thread_internal;
48
49
50 /**
51  * @var g_mutexInfo
52  * @brief This is used to return a non NULL value for oc_mutex_new().
53  */
54 static oc_mutex_internal g_mutexInfo = { 0 };
55
56 /**
57  * @var g_condInfo
58  * @brief This is used to return a non NULL value for oc_cond_new().
59  */
60 static oc_cond_internal g_condInfo = { 0 };
61
62 OCThreadResult_t oc_thread_new(oc_thread *t, void *(*start_routine)(void *), void *arg)
63 {
64     return OC_THREAD_CREATE_FAILURE;
65 }
66
67 OCThreadResult_t oc_thread_free(oc_thread t)
68 {
69     return OC_THREAD_INVALID;
70 }
71
72 OCThreadResult_t oc_thread_wait(oc_thread t)
73 {
74     return OC_THREAD_INVALID;
75 }
76
77 oc_mutex oc_mutex_new(void)
78 {
79     return (oc_mutex)&g_mutexInfo;
80 }
81
82 bool oc_mutex_free(oc_mutex mutex)
83 {
84     return true;
85 }
86
87 void oc_mutex_lock(oc_mutex mutex)
88 {
89     return;
90 }
91
92 void oc_mutex_unlock(oc_mutex mutex)
93 {
94     return;
95 }
96
97 oc_cond oc_cond_new(void)
98 {
99     return (oc_cond)&g_condInfo;
100 }
101
102 void oc_cond_free(oc_cond cond)
103 {
104     return;
105 }
106
107 void oc_cond_signal(oc_cond cond)
108 {
109     return;
110 }
111
112 void oc_cond_broadcast(oc_cond cond)
113 {
114     return;
115 }
116
117 void oc_cond_wait(oc_cond cond, oc_mutex mutex)
118 {
119     return;
120 }
121
122 OCWaitResult_t oc_cond_wait_for(oc_cond cond, oc_mutex mutex, uint64_t microseconds)
123 {
124     return OC_WAIT_SUCCESS;
125 }
126