Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
acd36896
提交
acd36896
authored
4月 30, 2012
作者:
Christopher Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-4064 mod_posix_timer workaround of CentOS 5 glibc problem
上级
42834083
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
755 行增加
和
90 行删除
+755
-90
mod_posix_timer.c
src/mod/timers/mod_posix_timer/mod_posix_timer.c
+305
-64
Makefile
src/mod/timers/mod_posix_timer/test/Makefile
+1
-1
main.c
src/mod/timers/mod_posix_timer/test/main.c
+435
-18
switch.c
src/mod/timers/mod_posix_timer/test/switch.c
+10
-6
switch.h
src/mod/timers/mod_posix_timer/test/switch.h
+4
-1
没有找到文件。
src/mod/timers/mod_posix_timer/mod_posix_timer.c
浏览文件 @
acd36896
差异被折叠。
点击展开。
src/mod/timers/mod_posix_timer/test/Makefile
浏览文件 @
acd36896
all
:
gcc ../mod_posix_timer.c main.c switch.c
-I
.
-o
timer_test
-lpthread
-lrt
-g
-DLOG_LEVEL
=
-1
gcc ../mod_posix_timer.c main.c switch.c
-I
.
-o
timer_test
-lpthread
-lrt
-
lm
-
g
-DLOG_LEVEL
=
-1
clean
:
-
rm
timer_test
...
...
src/mod/timers/mod_posix_timer/test/main.c
浏览文件 @
acd36896
差异被折叠。
点击展开。
src/mod/timers/mod_posix_timer/test/switch.c
浏览文件 @
acd36896
...
...
@@ -42,13 +42,17 @@ switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_me
return
pthread_cond_init
(
*
cond
,
NULL
);
}
switch_status_t
switch_thread_cond_timedwait
(
switch_thread_cond_t
*
cond
,
switch_mutex_t
*
mutex
,
int
wait
)
switch_status_t
switch_thread_cond_timedwait
(
switch_thread_cond_t
*
cond
,
switch_mutex_t
*
mutex
,
long
wait
)
{
struct
timespec
dur
=
{
0
,
0
};
clock_gettime
(
CLOCK_REALTIME
,
&
dur
);
dur
.
tv_sec
=
wait
/
1000000000
;
dur
.
tv_nsec
=
wait
%
1000000000
;
return
pthread_cond_timedwait
(
cond
,
mutex
,
&
dur
);
struct
timespec
abs_time
=
{
0
,
0
};
/* add wait duration to current time (wait is in microseconds, pthreads wants nanosecond resolution) */
clock_gettime
(
CLOCK_REALTIME
,
&
abs_time
);
abs_time
.
tv_sec
+=
wait
/
1000000
;
abs_time
.
tv_nsec
+=
(
wait
%
1000000
)
*
1000
;
/* handle overflow of tv_nsec */
abs_time
.
tv_sec
+=
abs_time
.
tv_nsec
/
1000000000
;
abs_time
.
tv_nsec
=
abs_time
.
tv_nsec
%
1000000000
;
return
pthread_cond_timedwait
(
cond
,
mutex
,
&
abs_time
);
}
switch_status_t
switch_thread_cond_broadcast
(
switch_thread_cond_t
*
cond
)
...
...
src/mod/timers/mod_posix_timer/test/switch.h
浏览文件 @
acd36896
...
...
@@ -9,12 +9,15 @@
#define SWITCH_STATUS_SUCCESS 0
#define SWITCH_STATUS_GENERR 1
#define SWITCH_STATUS_FALSE 2
#define SWITCH_STATUS_TERM 3
#define SWITCH_MUTEX_NESTED 1
#define SWITCH_CHANNEL_LOG 0
#define SWITCH_LOG_DEBUG 0
#define SWITCH_LOG_INFO 0
#define SWITCH_LOG_ERROR 1
typedef
int
switch_status_t
;
typedef
size_t
switch_size_t
;
...
...
@@ -113,7 +116,7 @@ switch_status_t switch_mutex_init(switch_mutex_t **mutex, int flags, switch_memo
switch_status_t
switch_thread_cond_create
(
switch_thread_cond_t
**
cond
,
switch_memory_pool_t
*
pool
);
switch_status_t
switch_thread_cond_timedwait
(
switch_thread_cond_t
*
cond
,
switch_mutex_t
*
mutex
,
int
wait
);
switch_status_t
switch_thread_cond_timedwait
(
switch_thread_cond_t
*
cond
,
switch_mutex_t
*
mutex
,
long
wait
);
switch_status_t
switch_thread_cond_broadcast
(
switch_thread_cond_t
*
cond
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论