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 ) ) \
35 debug_warning("try mutex init..\n"); \
36 if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
45 debug_error("mutex lock failed\n"); \
49 #define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \
50 switch ( pthread_mutex_lock( x_mutex ) ) \
53 debug_warning("try mutex init..\n"); \
54 if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
63 debug_error("mutex lock failed\n"); \
67 #define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \
68 if( pthread_mutex_unlock( x_mutex ) ) { \
69 debug_error("mutex unlock failed\n"); \
72 #define MMSOUND_STRNCPY(dst, src, size) \
75 debug_error("STRNCPY ERROR: Destination String is NULL"); \
76 else if (src == NULL) \
77 debug_error("STRNCPY ERROR: Source String is NULL"); \
79 debug_error("STRNCPY ERROR: Size(%d) <= 0", size); \
81 strncpy(dst, src, size - 1); \
82 dst[size - 1] = '\0';\
86 #endif /* __MM_SOUND_COMMON_H__ */