1 //******************************************************************
3 // Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 //*********************************************************************
26 * This file provides APIs related to mutex with no operation
27 * for Singlethread implementation.
33 * Logging tag for module name
37 typedef struct _tagMutexInfo_t
41 typedef struct _tagEventInfo_t
45 typedef struct _tagThreadInfo_t
52 * @brief This is used to return a non NULL value for oc_mutex_new().
54 static oc_mutex_internal g_mutexInfo = { 0 };
58 * @brief This is used to return a non NULL value for oc_cond_new().
60 static oc_cond_internal g_condInfo = { 0 };
62 OCThreadResult_t oc_thread_new(oc_thread *t, void *(*start_routine)(void *), void *arg)
64 return OC_THREAD_CREATE_FAILURE;
67 OCThreadResult_t oc_thread_free(oc_thread t)
69 return OC_THREAD_INVALID;
72 OCThreadResult_t oc_thread_wait(oc_thread t)
74 return OC_THREAD_INVALID;
77 oc_mutex oc_mutex_new(void)
79 return (oc_mutex)&g_mutexInfo;
82 bool oc_mutex_free(oc_mutex mutex)
87 void oc_mutex_lock(oc_mutex mutex)
92 void oc_mutex_unlock(oc_mutex mutex)
97 oc_cond oc_cond_new(void)
99 return (oc_cond)&g_condInfo;
102 void oc_cond_free(oc_cond cond)
107 void oc_cond_signal(oc_cond cond)
112 void oc_cond_broadcast(oc_cond cond)
117 void oc_cond_wait(oc_cond cond, oc_mutex mutex)
122 OCWaitResult_t oc_cond_wait_for(oc_cond cond, oc_mutex mutex, uint64_t microseconds)
124 return OC_WAIT_SUCCESS;