Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
3515c7a0
提交
3515c7a0
authored
7月 29, 2010
作者:
Jeff Lenk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FSCORE-643 Windows: Add start parameter -monotonic-clock, replaces build flag WIN32_MONOTONIC
上级
b80eb9fb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
27 行增加
和
7 行删除
+27
-7
switch_types.h
src/include/switch_types.h
+2
-1
switch.c
src/switch.c
+14
-0
switch_time.c
src/switch_time.c
+11
-6
没有找到文件。
src/include/switch_types.h
浏览文件 @
3515c7a0
...
...
@@ -251,7 +251,8 @@ typedef enum {
SCF_CALIBRATE_CLOCK
=
(
1
<<
8
),
SCF_USE_HEAVY_TIMING
=
(
1
<<
9
),
SCF_USE_CLOCK_RT
=
(
1
<<
10
),
SCF_VERBOSE_EVENTS
=
(
1
<<
11
)
SCF_VERBOSE_EVENTS
=
(
1
<<
11
),
SCF_USE_WIN32_MONOTONIC
=
(
1
<<
12
)
}
switch_core_flag_enum_t
;
typedef
uint32_t
switch_core_flag_t
;
...
...
src/switch.c
浏览文件 @
3515c7a0
...
...
@@ -62,6 +62,7 @@ static char *pfile = PIDFILE;
#define SERVICENAME_DEFAULT "FreeSWITCH"
#define SERVICENAME_MAXLEN 256
static
char
service_name
[
SERVICENAME_MAXLEN
];
static
switch_core_flag_t
service_flags
=
SCF_NONE
;
#include <winsock2.h>
#include <windows.h>
...
...
@@ -174,6 +175,11 @@ void WINAPI service_main(DWORD numArgs, char **args)
{
switch_core_flag_t
flags
=
SCF_USE_SQL
|
SCF_USE_AUTO_NAT
|
SCF_CALIBRATE_CLOCK
|
SCF_USE_CLOCK_RT
;
const
char
*
err
=
NULL
;
/* error value for return from freeswitch initialization */
/* Override flags if they have been set earlier */
if
(
service_flags
!=
SCF_NONE
)
flags
=
service_flags
;
/* we have to initialize the service-specific stuff */
memset
(
&
status
,
0
,
sizeof
(
SERVICE_STATUS
));
status
.
dwServiceType
=
SERVICE_WIN32
;
...
...
@@ -319,6 +325,7 @@ int main(int argc, char *argv[])
"
\t
-service [name] -- start freeswitch as a service, cannot be used if loaded as a console app
\n
"
"
\t
-install [name] -- install freeswitch as a service, with optional service name
\n
"
"
\t
-uninstall -- remove freeswitch as a service
\n
"
"
\t
-monotonic-clock -- use monotonic clock as timer source
\n
"
#else
"
\t
-nf -- no forking
\n
"
"
\t
-u [user] -- specify user to switch to
\n
"
"
\t
-g [group] -- specify group to switch to
\n
"
...
...
@@ -427,6 +434,11 @@ int main(int argc, char *argv[])
}
}
}
if
(
local_argv
[
x
]
&&
!
strcmp
(
local_argv
[
x
],
"-monotonic-clock"
))
{
flags
|=
SCF_USE_WIN32_MONOTONIC
;
known_opt
++
;
}
#else
if
(
local_argv
[
x
]
&&
!
strcmp
(
local_argv
[
x
],
"-u"
))
{
x
++
;
...
...
@@ -732,6 +744,8 @@ int main(int argc, char *argv[])
,
{
NULL
,
NULL
}
};
service_flags
=
flags
;
/* copy parsed flags for service startup */
if
(
StartServiceCtrlDispatcher
(
dispatchTable
)
==
0
)
{
/* Not loaded as a service */
fprintf
(
stderr
,
"Error Freeswitch loaded as a console app with -service option
\n
"
);
...
...
src/switch_time.c
浏览文件 @
3515c7a0
...
...
@@ -48,10 +48,11 @@
#define MAX_ELEMENTS 3600
#define IDLE_SPEED 100
/* For now enable WIN32_MONOTONIC on Windows 2003 Server and Windows XP systems for improved timer support */
/* GetSystemTimeAsFileTime does not update on timeBeginPeriod on these OS */
/* we leave the normal timer support as the default for now */
#if (defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)) || defined(WIN32_MONOTONIC)
/* In Windows, enable the montonic timer for better timer accuracy on Windows 2003 Server, XP and older */
/* GetSystemTimeAsFileTime does not update on timeBeginPeriod on these OS. */
/* Flag SCF_USE_WIN32_MONOTONIC must be enabled to activate it (start parameter -monotonic-clock) */
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
static
int
MONO
=
1
;
#else
static
int
MONO
=
0
;
...
...
@@ -344,7 +345,7 @@ static switch_time_t time_now(int64_t offset)
{
switch_time_t
now
;
#if (defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)) || defined(WIN32
_MONOTONIC
)
#if (defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)) || defined(WIN32)
if
(
MONO
)
{
#ifndef WIN32
struct
timespec
ts
;
...
...
@@ -375,7 +376,7 @@ static switch_time_t time_now(int64_t offset)
#endif
now
=
switch_time_now
();
#if (defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)) || defined(WIN32
_MONOTONIC
)
#if (defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)) || defined(WIN32)
}
#endif
...
...
@@ -1074,6 +1075,10 @@ SWITCH_MODULE_LOAD_FUNCTION(softtimer_load)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Clock calibration disabled.
\n
"
);
}
if
(
switch_test_flag
((
&
runtime
),
SCF_USE_WIN32_MONOTONIC
))
{
MONO
=
1
;
}
/* indicate that the module should continue to be loaded */
return
SWITCH_STATUS_SUCCESS
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论