summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_event_engine.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03Fixed #define style.Alejandro Colomar1-24/+12
We had a mix of styles for declaring function-like macros: Style A: #define \ foo() \ do { \ ... \ } while (0) Style B: #define foo() \ do { \ ... \ } while (0) We had a similar number of occurences of each style: $ grep -rnI '^\w*(.*\\' | wc -l 244 $ grep -rn 'define.*(.*)' | wc -l 239 (Those regexes aren't perfect, but a very decent approximation.) Real examples: $ find src -type f | xargs sed -n '/^nxt_double_is_zero/,/^$/p' nxt_double_is_zero(f) \ (fabs(f) <= FLT_EPSILON) $ find src -type f | xargs sed -n '/define nxt_http_field_set/,/^$/p' #define nxt_http_field_set(_field, _name, _value) \ do { \ (_field)->name_length = nxt_length(_name); \ (_field)->value_length = nxt_length(_value); \ (_field)->name = (u_char *) _name; \ (_field)->value = (u_char *) _value; \ } while (0) I'd like to standardize on a single style for them, and IMO, having the identifier in the same line as #define is a better option for the following reasons: - Programmers are used to `#define foo() ...` (readability). - One less line of code. - The program for finding them is really simple (see below). function grep_ngx_func() { if (($# != 1)); then >&2 echo "Usage: ${FUNCNAME[0]} <func>"; return 1; fi; find src -type f \ | grep '\.[ch]$' \ | xargs grep -l "$1" \ | sort \ | xargs pcregrep -Mn "(?s)^\$[\w\s*]+?^$1\(.*?^}"; find src -type f \ | grep '\.[ch]$' \ | xargs grep -l "$1" \ | sort \ | xargs pcregrep -Mn "(?s)define $1\(.*?^$" \ | sed -E '1s/^[^:]+:[0-9]+:/&\n\n/'; } $ grep_ngx_func Usage: grep_ngx_func <func> $ grep_ngx_func nxt_http_field_set src/nxt_http.h:98: #define nxt_http_field_set(_field, _name, _value) \ do { \ (_field)->name_length = nxt_length(_name); \ (_field)->value_length = nxt_length(_value); \ (_field)->name = (u_char *) _name; \ (_field)->value = (u_char *) _value; \ } while (0) $ grep_ngx_func nxt_sprintf src/nxt_sprintf.c:56: u_char * nxt_cdecl nxt_sprintf(u_char *buf, u_char *end, const char *fmt, ...) { u_char *p; va_list args; va_start(args, fmt); p = nxt_vsprintf(buf, end, fmt, args); va_end(args); return p; } ................ Scripted change: ................ $ find src -type f \ | grep '\.[ch]$' \ | xargs sed -i '/define *\\$/{N;s/ *\\\n/ /;s/ //}'
2019-11-14Introduced event engine memory buffers.Igor Sysoev1-0/+4
2019-11-14Event engine memory cache refactored.Igor Sysoev1-3/+5
2018-10-22Improved epoll failures handling.Igor Sysoev1-0/+2
epoll changes are committed to the kernel before epoll_wait() or on changes array overflow. In the latter case if there are errors epoll_wait() timeout was not set to zero. This commit is related to #173 issue on GitHub. Thanks to 洪志道 (Hong Zhi Dao).
2017-10-17Storing memory cache slot hint inside nxt_sockaddr_t.Igor Sysoev1-2/+2
2017-09-27Event engine memory cache for nxt_sockaddr_t.Igor Sysoev1-0/+6
Introducing event engine memory cache and using the cache for nxt_sockaddr_t structures.
2017-09-15Introducing application timeout.Max Romanov1-10/+0
2017-07-18Work queue thread assertions. Reset thread after fork.Max Romanov1-0/+10
2017-07-05Router: processing JSON configuration.Igor Sysoev1-0/+2
2017-06-23Added basic HTTP request processing in router.Max Romanov1-0/+10
- request to connection mapping in engine; - requests queue in connection; - engine port creation; - connected ports hash for each process; - engine port data messages processing (app responses);
2017-06-19Memory pools refactoring.Igor Sysoev1-1/+1
2017-06-14nxt_event_conn_... functions and structures have been renamedIgor Sysoev1-3/+3
to nxt_conn_...
2017-05-31Skeleton of router configuration and request processing.Igor Sysoev1-0/+10
2017-03-09Processes refactoring.Igor Sysoev1-4/+4
The cycle has been renamed to the runtime.
2017-02-22I/O operations refactoring.Igor Sysoev1-1/+1
2017-02-07Event engines refactoring.Igor Sysoev1-16/+439
2017-01-30nxt_event_timer has been renamed to nxt_timer.Igor Sysoev1-1/+1
2017-01-27Work queues refactoring.Igor Sysoev1-13/+6
2017-01-23Introducing tasks.Igor Sysoev1-2/+5
2017-01-17Initial version.Igor Sysoev1-0/+94