Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/os/unix
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2016-03-18 06:43:52 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2016-03-18 06:43:52 +0300
commitac78b26324a348ebdd108de0c022729b671549fb (patch)
tree606691334fa0d164469073bacb4c132c86a2f4d3 /src/os/unix
parent931ce7f02a9c55987ef9a7128882097b89a36540 (diff)
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.
Diffstat (limited to 'src/os/unix')
-rw-r--r--src/os/unix/ngx_files.c8
-rw-r--r--src/os/unix/ngx_files.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index 77ed0c0a4..13b9e3f0b 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -88,8 +88,8 @@ typedef struct {
ssize_t
-ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, u_char *buf,
- size_t size, off_t offset, ngx_pool_t *pool)
+ngx_thread_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset,
+ ngx_pool_t *pool)
{
ngx_thread_task_t *task;
ngx_thread_read_ctx_t *ctx;
@@ -98,7 +98,7 @@ ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, u_char *buf,
"thread read: %d, %p, %uz, %O",
file->fd, buf, size, offset);
- task = *taskp;
+ task = file->thread_task;
if (task == NULL) {
task = ngx_thread_task_alloc(pool, sizeof(ngx_thread_read_ctx_t));
@@ -108,7 +108,7 @@ ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, u_char *buf,
task->handler = ngx_thread_read_handler;
- *taskp = task;
+ file->thread_task = task;
}
ctx = task->ctx;
diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h
index 6081b003f..88b2f81cc 100644
--- a/src/os/unix/ngx_files.h
+++ b/src/os/unix/ngx_files.h
@@ -385,8 +385,8 @@ extern ngx_uint_t ngx_file_aio;
#endif
#if (NGX_THREADS)
-ssize_t ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file,
- u_char *buf, size_t size, off_t offset, ngx_pool_t *pool);
+ssize_t ngx_thread_read(ngx_file_t *file, u_char *buf, size_t size,
+ off_t offset, ngx_pool_t *pool);
#endif