Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 6441:9fd738b85fad
Threads: task pointer stored in ngx_file_t.
This simplifies the interface of the ngx_thread_read() function.
Additionally, most of the thread operations now explicitly set
file->thread_task, file->thread_handler and file->thread_ctx,
to facilitate use of thread operations in other places.
(Potential problems remain with sendfile in threads though - it uses
file->thread_handler as set in ngx_output_chain(), and it should not
be overwritten to an incompatible one.)
In collaboration with Valentin Bartenev.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 18 Mar 2016 06:43:52 +0300 |
parents | 4821fc788c12 |
children | 043914d19be8 |
comparison
equal
deleted
inserted
replaced
6440:248aa2757332 | 6441:9fd738b85fad |
---|---|
689 #endif | 689 #endif |
690 | 690 |
691 #if (NGX_THREADS) | 691 #if (NGX_THREADS) |
692 | 692 |
693 if (clcf->aio == NGX_HTTP_AIO_THREADS) { | 693 if (clcf->aio == NGX_HTTP_AIO_THREADS) { |
694 c->file.thread_task = c->thread_task; | |
694 c->file.thread_handler = ngx_http_cache_thread_handler; | 695 c->file.thread_handler = ngx_http_cache_thread_handler; |
695 c->file.thread_ctx = r; | 696 c->file.thread_ctx = r; |
696 | 697 |
697 n = ngx_thread_read(&c->thread_task, &c->file, c->buf->pos, | 698 n = ngx_thread_read(&c->file, c->buf->pos, c->body_start, 0, r->pool); |
698 c->body_start, 0, r->pool); | 699 |
699 | 700 c->thread_task = c->file.thread_task; |
700 c->reading = (n == NGX_AGAIN); | 701 c->reading = (n == NGX_AGAIN); |
701 | 702 |
702 return n; | 703 return n; |
703 } | 704 } |
704 | 705 |