4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungbae Shin <seungbae.shin@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __MM_SOUND_COMMON_H__
23 #define __MM_SOUND_COMMON_H__
27 #define PA_READY "/tmp/.pa_ready"
28 #define SOUND_SERVER_READY "/tmp/.sound_server_ready"
29 #define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
31 #define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \
32 switch (pthread_mutex_lock(x_mutex)) { \
34 debug_warning("try mutex init.."); \
35 if (0 > pthread_mutex_init(x_mutex, NULL)) { \
44 debug_error("mutex lock failed"); \
48 #define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex, x_return) \
49 switch (pthread_mutex_lock(x_mutex)) { \
51 debug_warning("try mutex init.."); \
52 if (0 > pthread_mutex_init(x_mutex, NULL)) { \
61 debug_error("mutex lock failed"); \
65 #define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \
66 if (pthread_mutex_unlock(x_mutex)) { \
67 debug_error("mutex unlock failed"); \
70 #define MMSOUND_STRNCPY(dst, src, size) \
73 debug_error("STRNCPY ERROR: Destination String is NULL"); \
74 else if (src == NULL) \
75 debug_error("STRNCPY ERROR: Source String is NULL"); \
77 debug_error("STRNCPY ERROR: Size(%d) <= 0", size); \
79 strncpy(dst, src, size - 1); \
80 dst[size - 1] = '\0';\
84 #endif /* __MM_SOUND_COMMON_H__ */