Mercurial > hg > nginx
comparison src/core/ngx_output_chain.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 | c5f81dcf97a7 |
children | 4395758d08e6 |
comparison
equal
deleted
inserted
replaced
6440:248aa2757332 | 6441:9fd738b85fad |
---|---|
575 } | 575 } |
576 | 576 |
577 } else | 577 } else |
578 #endif | 578 #endif |
579 #if (NGX_THREADS) | 579 #if (NGX_THREADS) |
580 if (src->file->thread_handler) { | 580 if (ctx->thread_handler) { |
581 n = ngx_thread_read(&ctx->thread_task, src->file, dst->pos, | 581 src->file->thread_task = ctx->thread_task; |
582 (size_t) size, src->file_pos, ctx->pool); | 582 src->file->thread_handler = ctx->thread_handler; |
583 src->file->thread_ctx = ctx->filter_ctx; | |
584 | |
585 n = ngx_thread_read(src->file, dst->pos, (size_t) size, | |
586 src->file_pos, ctx->pool); | |
583 if (n == NGX_AGAIN) { | 587 if (n == NGX_AGAIN) { |
588 ctx->thread_task = src->file->thread_task; | |
584 return NGX_AGAIN; | 589 return NGX_AGAIN; |
585 } | 590 } |
586 | 591 |
587 } else | 592 } else |
588 #endif | 593 #endif |