Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minheap #53

Closed
wants to merge 9 commits into from
Closed

Minheap #53

wants to merge 9 commits into from

Conversation

dinic
Copy link
Member

@dinic dinic commented Sep 5, 2012

support minheap and minheap4 for nginx event timer

add a instruction(named timer) in events block
events {
timer rbtree | minheap | minheap4;
}

default:rbtree

@@ -135,6 +143,13 @@ static char *ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd,
0,
NULL },

{ ngx_string("timer"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timers

@@ -26,7 +26,6 @@
typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restore this line

@yaoweibin
Copy link
Member

src/event/ngx_event_timer.h: In function ‘ngx_event_add_timer_minheap’:
src/event/ngx_event_timer.h:172: error: ‘ngx_event_timer_node_t’ has no member named ‘key’
src/event/ngx_event_timer.h: In function ‘ngx_event_add_timer_minheap4’:
src/event/ngx_event_timer.h:226: error: ‘ngx_event_timer_node_t’ has no member named ‘key’
make[1]: *** [objs/src/core/ngx_output_chain.o] Error 1
make[1]: Leaving directory `/home/wenjing.ywb/work/tengine_bak'
make: *** [build] Error 2

打开--with-debug选项编译出错了

@yaoweibin
Copy link
Member

coredump, 没有配置timer选项

Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x000000000044da6c in ngx_worker_process_cycle (cycle=0x1d4aa1f0, data=0x0) at src/os/unix/ngx_process_cycle.c:848
#2 0x000000000044908b in ngx_spawn_process (cycle=0x1d4aa1f0, proc=0x44d944 <ngx_worker_process_cycle>, data=0x0, name=0x560506 "worker process",
respawn=-3) at src/os/unix/ngx_process.c:189
#3 0x000000000044c95d in ngx_start_worker_processes (cycle=0x1d4aa1f0, n=1, type=-3) at src/os/unix/ngx_process_cycle.c:399
#4 0x000000000044bf97 in ngx_master_process_cycle (cycle=0x1d4aa1f0) at src/os/unix/ngx_process_cycle.c:146
#5 0x0000000000418f74 in main (argc=5, argv=0x7fffef8dfeb8) at src/core/nginx.c:454
(gdb) quit

@yaoweibin
Copy link
Member

Should we test this pull request more sufficiently?

typedef void (*ngx_event_expire_timers_pt)(void);
typedef void (*ngx_event_del_timer_pt)(ngx_event_t *ev);
typedef void (*ngx_event_add_timer_pt)(ngx_event_t *ev, ngx_msec_t timer);
typedef ngx_int_t (*ngx_event_timer_is_empty_pt)(void);
#endif /* _NGX_CORE_H_INCLUDED_ */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add a new line above

@chaizhenhua
Copy link

这个minheap 有没有可能出现时间溢出的问题?

ngx_rbtree_node_t rbtree;
ngx_minheap_node_t minheap;
} ngx_event_timer_node_t;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加入公共的 key 成员处理上是否会好一些

@@ -27,6 +27,7 @@ CORE_DEPS="src/core/nginx.h \
src/core/ngx_md5.h \
src/core/ngx_sha1.h \
src/core/ngx_rbtree.h \
src/core/ngx_minheap.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这对吗?

@dinic dinic closed this Jan 16, 2014
@dinic dinic deleted the minheap branch January 16, 2014 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants