Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
bcaa7a4f
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bcaa7a4f
编写于
1月 14, 2010
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set the new threads stack size to a LZF friendly amount
上级
427a2153
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
9 addition
and
1 deletion
+9
-1
redis.c
redis.c
+9
-1
未找到文件。
redis.c
浏览文件 @
bcaa7a4f
...
...
@@ -164,6 +164,7 @@
#define REDIS_VM_MAX_NEAR_PAGES 65536
#define REDIS_VM_MAX_RANDOM_JUMP 4096
#define REDIS_VM_MAX_THREADS 32
#define REDIS_THREAD_STACK_SIZE (1024*1024*4)
/* The following is the number of completed I/O jobs to process when the
* handelr is called. 1 is the minimum, and also the default, as it allows
* to block as little as possible other accessing clients. While Virtual
...
...
@@ -403,6 +404,7 @@ struct redisServer {
pthread_mutex_t
io_mutex
;
/* lock to access io_jobs/io_done/io_thread_job */
pthread_mutex_t
obj_freelist_mutex
;
/* safe redis objects creation/free */
pthread_mutex_t
io_swapfile_mutex
;
/* So we can lseek + write */
pthread_attr_t
io_threads_attr
;
/* attributes for threads creation */
int
io_active_threads
;
/* Number of running I/O threads */
int
vm_max_threads
;
/* Max number of I/O threads running at the same time */
/* Our main thread is blocked on the event loop, locking for sockets ready
...
...
@@ -6984,6 +6986,7 @@ static void aofRemoveTempFile(pid_t childpid) {
static
void
vmInit
(
void
)
{
off_t
totsize
;
int
pipefds
[
2
];
size_t
stacksize
;
server
.
vm_fp
=
fopen
(
"/tmp/redisvm"
,
"w+b"
);
if
(
server
.
vm_fp
==
NULL
)
{
...
...
@@ -7031,6 +7034,11 @@ static void vmInit(void) {
server
.
io_ready_pipe_read
=
pipefds
[
0
];
server
.
io_ready_pipe_write
=
pipefds
[
1
];
redisAssert
(
anetNonBlock
(
NULL
,
server
.
io_ready_pipe_read
)
!=
ANET_ERR
);
/* LZF requires a lot of stack */
pthread_attr_init
(
&
server
.
io_threads_attr
);
pthread_attr_getstacksize
(
&
server
.
io_threads_attr
,
&
stacksize
);
while
(
stacksize
<
REDIS_THREAD_STACK_SIZE
)
stacksize
*=
2
;
pthread_attr_setstacksize
(
&
server
.
io_threads_attr
,
stacksize
);
/* Listen for events in the threaded I/O pipe */
if
(
aeCreateFileEvent
(
server
.
el
,
server
.
io_ready_pipe_read
,
AE_READABLE
,
vmThreadedIOCompletedJob
,
NULL
)
==
AE_ERR
)
...
...
@@ -7668,7 +7676,7 @@ static void *IOThreadEntryPoint(void *arg) {
static
void
spawnIOThread
(
void
)
{
pthread_t
thread
;
pthread_create
(
&
thread
,
NULL
,
IOThreadEntryPoint
,
NULL
);
pthread_create
(
&
thread
,
&
server
.
io_threads_attr
,
IOThreadEntryPoint
,
NULL
);
server
.
io_active_threads
++
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录