Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bingbingbingbing
mono
提交
c731686f
M
mono
项目概览
bingbingbingbing
/
mono
与 Fork 源项目一致
从无法访问的项目Fork
通知
35
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mono
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c731686f
编写于
1月 30, 2015
作者:
R
Rodrigo Kumpera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't include the poll backed directly into the threadpool source code.
上级
ebf7c45f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
25 deletion
+52
-25
mono/metadata/Makefile.am
mono/metadata/Makefile.am
+1
-0
mono/metadata/threadpool-internals.h
mono/metadata/threadpool-internals.h
+24
-0
mono/metadata/threadpool.c
mono/metadata/threadpool.c
+16
-23
mono/metadata/tpool-poll.c
mono/metadata/tpool-poll.c
+11
-2
未找到文件。
mono/metadata/Makefile.am
浏览文件 @
c731686f
...
...
@@ -194,6 +194,7 @@ common_sources = \
threadpool.c
\
threadpool.h
\
threadpool-internals.h
\
tpool-poll.c
\
verify.c
\
verify-internals.h
\
wrapper-types.h
\
...
...
mono/metadata/threadpool-internals.h
浏览文件 @
c731686f
...
...
@@ -3,10 +3,34 @@
#include <glib.h>
#include <mono/metadata/object.h>
#include <mono/metadata/mono-hash.h>
#include <mono/metadata/mono-mlist.h>
#include <mono/utils/mono-compiler.h>
typedef
struct
{
mono_mutex_t
io_lock
;
/* access to sock_to_state */
int
inited
;
// 0 -> not initialized , 1->initializing, 2->initialized, 3->cleaned up
MonoGHashTable
*
sock_to_state
;
gint
event_system
;
gpointer
event_data
;
void
(
*
modify
)
(
gpointer
p
,
int
fd
,
int
operation
,
int
events
,
gboolean
is_new
);
void
(
*
wait
)
(
gpointer
sock_data
);
void
(
*
shutdown
)
(
gpointer
event_data
);
}
SocketIOData
;
void
mono_thread_pool_remove_socket
(
int
sock
)
MONO_INTERNAL
;
gboolean
mono_thread_pool_is_queue_array
(
MonoArray
*
o
)
MONO_INTERNAL
;
void
mono_internal_thread_unhandled_exception
(
MonoObject
*
exc
)
MONO_INTERNAL
;
//TP implementations
gpointer
tp_poll_init
(
SocketIOData
*
data
)
MONO_INTERNAL
;
//TP internals the impls use
void
check_for_interruption_critical
(
void
)
MONO_INTERNAL
;
void
socket_io_cleanup
(
SocketIOData
*
data
)
MONO_INTERNAL
;
MonoObject
*
get_io_event
(
MonoMList
**
list
,
gint
event
)
MONO_INTERNAL
;
int
get_events_from_list
(
MonoMList
*
list
)
MONO_INTERNAL
;
void
threadpool_append_async_io_jobs
(
MonoObject
**
jobs
,
gint
njobs
)
MONO_INTERNAL
;
#endif
mono/metadata/threadpool.c
浏览文件 @
c731686f
...
...
@@ -83,18 +83,6 @@ enum {
MONITOR_STATE_SLEEPING
};
typedef
struct
{
mono_mutex_t
io_lock
;
/* access to sock_to_state */
int
inited
;
// 0 -> not initialized , 1->initializing, 2->initialized, 3->cleaned up
MonoGHashTable
*
sock_to_state
;
gint
event_system
;
gpointer
event_data
;
void
(
*
modify
)
(
gpointer
p
,
int
fd
,
int
operation
,
int
events
,
gboolean
is_new
);
void
(
*
wait
)
(
gpointer
sock_data
);
void
(
*
shutdown
)
(
gpointer
event_data
);
}
SocketIOData
;
static
SocketIOData
socket_io_data
;
/* Keep in sync with the System.MonoAsyncCall class which provides GC tracking */
...
...
@@ -148,11 +136,7 @@ static void threadpool_kill_idle_threads (ThreadPool *tp);
static
gboolean
threadpool_start_thread
(
ThreadPool
*
tp
);
static
void
threadpool_kill_thread
(
ThreadPool
*
tp
);
static
void
monitor_thread
(
gpointer
data
);
static
void
socket_io_cleanup
(
SocketIOData
*
data
);
static
MonoObject
*
get_io_event
(
MonoMList
**
list
,
gint
event
);
static
int
get_events_from_list
(
MonoMList
*
list
);
static
int
get_event_from_state
(
MonoSocketAsyncResult
*
state
);
static
void
check_for_interruption_critical
(
void
);
static
MonoClass
*
async_call_klass
;
static
MonoClass
*
socket_async_call_klass
;
...
...
@@ -196,7 +180,7 @@ enum {
AIO_OP_LAST
};
#include <mono/metadata/tpool-poll.c>
//
#include <mono/metadata/tpool-poll.c>
#ifdef HAVE_EPOLL
#include <mono/metadata/tpool-epoll.c>
#elif defined(USE_KQUEUE_FOR_THREADPOOL)
...
...
@@ -300,7 +284,10 @@ is_sdp_asyncreadhandler (MonoDomain *domain, MonoClass *klass)
#ifdef DISABLE_SOCKETS
#define socket_io_cleanup(x)
void
socket_io_cleanup
(
SocketIOData
*
data
)
{
}
static
int
get_event_from_state
(
MonoSocketAsyncResult
*
state
)
...
...
@@ -309,7 +296,7 @@ get_event_from_state (MonoSocketAsyncResult *state)
return
-
1
;
}
static
int
int
get_events_from_list
(
MonoMList
*
list
)
{
return
0
;
...
...
@@ -317,7 +304,7 @@ get_events_from_list (MonoMList *list)
#else
static
void
void
socket_io_cleanup
(
SocketIOData
*
data
)
{
mono_mutex_lock
(
&
data
->
io_lock
);
...
...
@@ -355,7 +342,7 @@ get_event_from_state (MonoSocketAsyncResult *state)
}
}
static
int
int
get_events_from_list
(
MonoMList
*
list
)
{
MonoSocketAsyncResult
*
state
;
...
...
@@ -404,7 +391,7 @@ threadpool_jobs_dec (MonoObject *obj)
return
FALSE
;
}
static
MonoObject
*
MonoObject
*
get_io_event
(
MonoMList
**
list
,
gint
event
)
{
MonoObject
*
state
;
...
...
@@ -1237,6 +1224,12 @@ threadpool_append_job (ThreadPool *tp, MonoObject *ar)
threadpool_append_jobs
(
tp
,
&
ar
,
1
);
}
void
threadpool_append_async_io_jobs
(
MonoObject
**
jobs
,
gint
njobs
)
{
threadpool_append_jobs
(
&
async_io_tp
,
jobs
,
njobs
);
}
static
void
threadpool_append_jobs
(
ThreadPool
*
tp
,
MonoObject
**
jobs
,
gint
njobs
)
{
...
...
@@ -1529,7 +1522,7 @@ clear_thread_state (void)
ves_icall_System_Threading_Thread_SetState
(
thread
,
ThreadState_Background
);
}
static
void
void
check_for_interruption_critical
(
void
)
{
MonoInternalThread
*
thread
;
...
...
mono/metadata/tpool-poll.c
浏览文件 @
c731686f
...
...
@@ -8,6 +8,15 @@
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2011 Novell, Inc (http://www.novell.com)
*/
#include <config.h>
#include <glib.h>
#include <errno.h>
#include <mono/metadata/mono-ptr-array.h>
#include <mono/metadata/threadpool.h>
#include <mono/metadata/threadpool-internals.h>
#include <mono/utils/mono-semaphore.h>
#include <mono/utils/mono-poll.h>
#define INIT_POLLFD(a, b, c) {(a)->fd = b; (a)->events = c; (a)->revents = 0;}
struct
_tp_poll_data
{
...
...
@@ -22,7 +31,7 @@ static void tp_poll_shutdown (gpointer event_data);
static
void
tp_poll_modify
(
gpointer
p
,
int
fd
,
int
operation
,
int
events
,
gboolean
is_new
);
static
void
tp_poll_wait
(
gpointer
p
);
static
gpointer
gpointer
tp_poll_init
(
SocketIOData
*
data
)
{
tp_poll_data
*
result
;
...
...
@@ -315,7 +324,7 @@ tp_poll_wait (gpointer p)
}
}
mono_mutex_unlock
(
&
socket_io_data
->
io_lock
);
threadpool_append_
jobs
(
&
async_io_tp
,
(
MonoObject
**
)
async_results
.
data
,
nresults
);
threadpool_append_
async_io_jobs
(
(
MonoObject
**
)
async_results
.
data
,
nresults
);
mono_ptr_array_clear
(
async_results
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录