Mercurial > hg > nginx-quic
comparison src/event/modules/ngx_epoll_module.c @ 6061:953ef81705e1
Events: fixed possible crash on start or reload.
The main thread could wake up and start processing the notify event
before the handler was set.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Fri, 27 Mar 2015 21:19:20 +0300 |
parents | 4652f8f26b12 |
children | d0a84ae2fb48 |
comparison
equal
deleted
inserted
replaced
6060:3d4730eada9c | 6061:953ef81705e1 |
---|---|
681 static ngx_int_t | 681 static ngx_int_t |
682 ngx_epoll_notify(ngx_event_handler_pt handler) | 682 ngx_epoll_notify(ngx_event_handler_pt handler) |
683 { | 683 { |
684 static uint64_t inc = 1; | 684 static uint64_t inc = 1; |
685 | 685 |
686 notify_event.data = handler; | |
687 | |
686 if ((size_t) write(notify_fd, &inc, sizeof(uint64_t)) != sizeof(uint64_t)) { | 688 if ((size_t) write(notify_fd, &inc, sizeof(uint64_t)) != sizeof(uint64_t)) { |
687 ngx_log_error(NGX_LOG_ALERT, notify_event.log, ngx_errno, | 689 ngx_log_error(NGX_LOG_ALERT, notify_event.log, ngx_errno, |
688 "write() to eventfd %d failed", notify_fd); | 690 "write() to eventfd %d failed", notify_fd); |
689 return NGX_ERROR; | 691 return NGX_ERROR; |
690 } | 692 } |
691 | |
692 notify_event.data = handler; | |
693 | 693 |
694 return NGX_OK; | 694 return NGX_OK; |
695 } | 695 } |
696 | 696 |
697 #endif | 697 #endif |