From 10c8c8d6a47db5e84825479438ce5848b2d1dda4 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Fri, 18 Mar 2016 06:44:03 +0300 Subject: Threads: offloading of temp files writing to thread pools. The ngx_thread_write_chain_to_file() function introduced, which uses ngx_file_t thread_handler, thread_ctx and thread_task fields. The task context structure (ngx_thread_file_ctx_t) is the same for both reading and writing, and can be safely shared as long as operations are serialized. The task->handler field is now always set (and not only when task is allocated), as the same task can be used with different handlers. The thread_write flag is introduced in the ngx_temp_file_t structure to explicitly enable use of ngx_thread_write_chain_to_file() in ngx_write_chain_to_temp_file() when supported by caller. In collaboration with Valentin Bartenev. --- src/os/unix/ngx_files.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/os/unix/ngx_files.h') diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index 88b2f81cc..07872b138 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -387,6 +387,8 @@ extern ngx_uint_t ngx_file_aio; #if (NGX_THREADS) ssize_t ngx_thread_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset, ngx_pool_t *pool); +ssize_t ngx_thread_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, + off_t offset, ngx_pool_t *pool); #endif -- cgit v1.2.3