Print this page
3909 Fix hang when sending dedup stream

@@ -1564,12 +1564,12 @@
                 err = ENOENT;
 
         if (tid != 0) {
                 if (err != 0)
                         (void) pthread_cancel(tid);
-                (void) pthread_join(tid, NULL);
                 (void) close(pipefd[0]);
+                (void) pthread_join(tid, NULL);
         }
 
         if (sdd.cleanup_fd != -1) {
                 VERIFY(0 == close(sdd.cleanup_fd));
                 sdd.cleanup_fd = -1;

@@ -1601,12 +1601,12 @@
 
         if (sdd.cleanup_fd != -1)
                 VERIFY(0 == close(sdd.cleanup_fd));
         if (tid != 0) {
                 (void) pthread_cancel(tid);
-                (void) pthread_join(tid, NULL);
                 (void) close(pipefd[0]);
+                (void) pthread_join(tid, NULL);
         }
         return (err);
 }
 
 /*