diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-06-19 22:42:38 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-06-19 22:42:38 +0000 |
commit | 7eafccef7f5788e54efa5318d9f5af13a0cbd291 (patch) | |
tree | 0b813ada0adf19ae9971f15c347de85b34a69de6 /lib/fuse_mt.c | |
parent | 152f29edc452f36210c1a8e0e0d648ac08fbf1bc (diff) | |
download | libfuse-7eafccef7f5788e54efa5318d9f5af13a0cbd291.tar.gz |
pre-allocate request structures
Diffstat (limited to 'lib/fuse_mt.c')
-rw-r--r-- | lib/fuse_mt.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c index 40da6ed..aa9dc7e 100644 --- a/lib/fuse_mt.c +++ b/lib/fuse_mt.c @@ -31,17 +31,17 @@ static void *do_work(void *data) struct fuse_worker *w = (struct fuse_worker *) data; struct fuse *f = w->f; - while(1) { + while (1) { struct fuse_cmd *cmd; - if(f->exited) + if (f->exited) break; cmd = __fuse_read_cmd(w->f); - if(cmd == NULL) + if (cmd == NULL) continue; - if(f->numavail == 0 && f->numworker < FUSE_MAX_WORKERS) { + if (f->numavail == 0 && f->numworker < FUSE_MAX_WORKERS) { pthread_mutex_lock(&f->lock); f->numavail ++; f->numworker ++; @@ -67,7 +67,7 @@ static void start_thread(struct fuse_worker *w) pthread_sigmask(SIG_SETMASK, &newset, &oldset); res = pthread_create(&thrid, NULL, do_work, w); pthread_sigmask(SIG_SETMASK, &oldset, NULL); - if(res != 0) { + if (res != 0) { fprintf(stderr, "Error creating thread: %s\n", strerror(res)); exit(1); } @@ -79,7 +79,7 @@ static struct fuse_context *mt_getcontext(struct fuse *f) struct fuse_context *ctx; ctx = (struct fuse_context *) pthread_getspecific(f->context_key); - if(ctx == NULL) { + if (ctx == NULL) { ctx = (struct fuse_context *) malloc(sizeof(struct fuse_context)); pthread_setspecific(f->context_key, ctx); } @@ -104,7 +104,7 @@ void __fuse_loop_mt(struct fuse *f, fuse_processor_t proc, void *data) f->numworker = 1; res = pthread_key_create(&f->context_key, mt_freecontext); - if(res != 0) { + if (res != 0) { fprintf(stderr, "Failed to create thread specific key\n"); exit(1); } @@ -114,7 +114,7 @@ void __fuse_loop_mt(struct fuse *f, fuse_processor_t proc, void *data) void fuse_loop_mt(struct fuse *f) { - if(f == NULL) + if (f == NULL) return; __fuse_loop_mt(f, (fuse_processor_t) __fuse_process_cmd, NULL); |