3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "utility/sync_util.h"
19 #include "utility/fw_thread.h"
23 #define EXPORT_API __attribute__ ((visibility("default")))
26 #ifndef SYNC_AGENT_LOG
28 #define LOG_TAG "AF_THREAD"
31 pthread_mutex_t *util_alloc_init_mutex(void)
35 pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
39 if (0 != pthread_mutex_init(mutex, NULL)) {
50 void util_free_mutex(pthread_mutex_t * mutex)
55 pthread_mutex_destroy(mutex);
62 pthread_cond_t *util_alloc_init_thread_cond(void)
66 pthread_cond_t *thread_cond = (pthread_cond_t *) malloc(sizeof(pthread_cond_t));
67 if (thread_cond == NULL) {
71 if (0 != pthread_cond_init(thread_cond, 0)) {
82 void util_free_thread_cond(pthread_cond_t * thread_cond)
86 if (thread_cond != NULL) {
87 pthread_cond_destroy(thread_cond);