about summary refs log tree commit homepage
path: root/digest.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-07-11 19:06:27 +0000
committerEric Wong <normalperson@yhbt.net>2013-07-11 19:06:27 +0000
commitf83d0466afc32542f3f4ff962105c817a1be2c96 (patch)
treec6b9e2b0b9002baf4b6f2cabb982dd0820cceba6 /digest.c
parentdaab757f5e52ce36a47e2d713365d68367a0e6dd (diff)
downloadcmogstored-f83d0466afc32542f3f4ff962105c817a1be2c96.tar.gz
We want to yield dying threads as soon as possible during
thread shutdown, so we check the quit flag and yield the
running thread to trigger a MOG_NEXT_ACTIVE.
Diffstat (limited to 'digest.c')
-rw-r--r--digest.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/digest.c b/digest.c
index 2f2b6d7..090c695 100644
--- a/digest.c
+++ b/digest.c
@@ -28,6 +28,8 @@ enum mog_digest_next mog_digest_read(struct mog_digest *digest, int fd)
 
                 if (r > 0) { /* most likely */
                         gc_hash_write(digest->ctx, r, buf);
+                        if (mog_thr_prepare_quit())
+                                return MOG_DIGEST_YIELD;
                 } else if (r == 0) {
                         /* wait for user to call mog_digest_hex() */
                         return MOG_DIGEST_EOF;