Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f8f91362
提交
f8f91362
authored
5月 20, 2010
作者:
Jeff Lenk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FSCORE-606 (Win) bridge fails because session read lock failure
上级
e15abcf9
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
19 行增加
和
5 行删除
+19
-5
apr_arch_thread_rwlock.h
libs/apr/include/arch/win32/apr_arch_thread_rwlock.h
+1
-0
thread_rwlock.c
libs/apr/locks/win32/thread_rwlock.c
+18
-5
没有找到文件。
libs/apr/include/arch/win32/apr_arch_thread_rwlock.h
浏览文件 @
f8f91362
...
...
@@ -24,6 +24,7 @@ struct apr_thread_rwlock_t {
HANDLE
write_mutex
;
HANDLE
read_event
;
LONG
readers
;
CRITICAL_SECTION
read_section
;
};
#endif
/* THREAD_RWLOCK_H */
...
...
libs/apr/locks/win32/thread_rwlock.c
浏览文件 @
f8f91362
...
...
@@ -28,6 +28,8 @@ static apr_status_t thread_rwlock_cleanup(void *data)
if
(
!
CloseHandle
(
rwlock
->
read_event
))
return
apr_get_os_error
();
DeleteCriticalSection
(
&
rwlock
->
read_section
);
if
(
!
CloseHandle
(
rwlock
->
write_mutex
))
return
apr_get_os_error
();
...
...
@@ -53,6 +55,8 @@ APR_DECLARE(apr_status_t)apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
return
apr_get_os_error
();
}
InitializeCriticalSection
(
&
(
*
rwlock
)
->
read_section
);
apr_pool_cleanup_register
(
pool
,
*
rwlock
,
thread_rwlock_cleanup
,
apr_pool_cleanup_null
);
...
...
@@ -62,10 +66,14 @@ APR_DECLARE(apr_status_t)apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
static
apr_status_t
apr_thread_rwlock_rdlock_core
(
apr_thread_rwlock_t
*
rwlock
,
DWORD
milliseconds
)
{
DWORD
code
=
WaitForSingleObject
(
rwlock
->
write_mutex
,
milliseconds
);
DWORD
code
;
EnterCriticalSection
(
&
rwlock
->
read_section
);
code
=
WaitForSingleObject
(
rwlock
->
write_mutex
,
milliseconds
);
if
(
code
==
WAIT_FAILED
||
code
==
WAIT_TIMEOUT
)
if
(
code
==
WAIT_FAILED
||
code
==
WAIT_TIMEOUT
)
{
LeaveCriticalSection
(
&
rwlock
->
read_section
);
return
APR_FROM_OS_ERROR
(
code
);
}
/* We've successfully acquired the writer mutex, we can't be locked
* for write, so it's OK to add the reader lock. The writer mutex
...
...
@@ -73,12 +81,17 @@ static apr_status_t apr_thread_rwlock_rdlock_core(apr_thread_rwlock_t *rwlock,
*/
InterlockedIncrement
(
&
rwlock
->
readers
);
if
(
!
ResetEvent
(
rwlock
->
read_event
))
if
(
!
ResetEvent
(
rwlock
->
read_event
))
{
LeaveCriticalSection
(
&
rwlock
->
read_section
);
return
apr_get_os_error
();
}
if
(
!
ReleaseMutex
(
rwlock
->
write_mutex
))
if
(
!
ReleaseMutex
(
rwlock
->
write_mutex
))
{
LeaveCriticalSection
(
&
rwlock
->
read_section
);
return
apr_get_os_error
();
}
LeaveCriticalSection
(
&
rwlock
->
read_section
);
return
APR_SUCCESS
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论