- Lauri
>From e7b41e17112c3c5aaabfe51b9862d159118ee826 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen <[email protected]> Date: Thu, 14 Jun 2012 17:46:04 +0300 Subject: [PATCH 2/2] cgi: Use worker_spawn to conserve thread resources (detached)
Signed-off-by: Lauri Kasanen <[email protected]> --- plugins/cgi/cgi.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/cgi/cgi.c b/plugins/cgi/cgi.c index ce32690..0d68fcb 100644 --- a/plugins/cgi/cgi.c +++ b/plugins/cgi/cgi.c @@ -63,14 +63,12 @@ static int swrite(const int fd, const void *buf, const size_t count) return 1; } -static void *cgi_write_post(void *p) +static void cgi_write_post(void *p) { const struct post_t * const in = p; swrite(in->fd, in->buf, in->len); close(in->fd); - - return NULL; } static int do_cgi(const char * const __restrict__ file, const char * const __restrict__ url, @@ -228,9 +226,7 @@ static int do_cgi(const char * const __restrict__ file, const char * const __res p.buf = sr->data.data; p.len = sr->data.len; - pthread_t tid; - - pthread_create(&tid, NULL, cgi_write_post, &p); + mk_api->worker_spawn(cgi_write_post, &p); } char buf[PATHLEN], *outptr; -- 1.7.2.1
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
