pcd1193182 commented on this pull request.


>               (void) fprintf(stderr, "TIME        SENT   SNAPSHOT\n");
 
        /*
         * Print the progress from ZFS_IOC_SEND_PROGRESS every second.
         */
        for (;;) {
-               (void) sleep(1);
+
+               /*
+                * If we are doing 'send -v' sleep for 1 second, otherwise
+                * sleep forever, until signal or quitting.
+                */
+               if (!pa->pa_progress) {
+                       while (send_progress_thread_signal == 0)
+                               (void) sleep(1);

POSIX does specify that thread-shared semaphores will wakeup on signals, but 
will return EINTR so you can sleep again. See 
https://linux.die.net/man/3/sem_wait for details (and an example that is pretty 
similar to this). I think all the platforms we care about porting ZFS to have a 
POSIX-compliant concurrency library, but I also understand if you don't want to 
worry about it too much.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/638#discussion_r222413646
------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/T000e5d283b7db7e5-Mc6e40bdc4635ed0604a4733c
Delivery options: https://openzfs.topicbox.com/groups/developer/subscription

Reply via email to