diff options
author | lurchi <lurchi@strangeplace.net> | 2017-08-09 22:37:43 +0200 |
---|---|---|
committer | lurchi <lurchi@strangeplace.net> | 2017-08-09 22:37:43 +0200 |
commit | 6fcafa3adc10394ad79db171a3a22c3260512f43 (patch) | |
tree | 700f5e04b5f6c04e6d38bf59e28ade25a2c3d0a7 /src | |
parent | 850ba0f677939b740ccff2d4dcaabe028ff5faf2 (diff) | |
download | gnunet-6fcafa3adc10394ad79db171a3a22c3260512f43.tar.gz gnunet-6fcafa3adc10394ad79db171a3a22c3260512f43.zip |
cosmetic fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/util/scheduler.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index f2fdbef2b..5a727c663 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -577,11 +577,15 @@ sighandler_shutdown () | |||
577 | 577 | ||
578 | 578 | ||
579 | /** | 579 | /** |
580 | * Check if the system is still alive. Trigger shutdown if we | 580 | * Check if the system has initiated shutdown. This means no tasks |
581 | * have tasks, but none of them give us lifeness. | 581 | * that prevent shutdown were present and all tasks added with |
582 | * #GNUNET_SCHEDULER_add_shutdown were run already. | ||
582 | * | 583 | * |
583 | * @return #GNUNET_OK to continue the main loop, | 584 | * Can be used by external event loop implementations to decide |
584 | * #GNUNET_NO to exit | 585 | * whether to keep running or not. |
586 | * | ||
587 | * @return #GNUNET_YES if tasks which prevent shutdown exist | ||
588 | * #GNUNET_NO if the system has initiated shutdown | ||
585 | */ | 589 | */ |
586 | int | 590 | int |
587 | GNUNET_SCHEDULER_check_lifeness () | 591 | GNUNET_SCHEDULER_check_lifeness () |
@@ -589,20 +593,20 @@ GNUNET_SCHEDULER_check_lifeness () | |||
589 | struct GNUNET_SCHEDULER_Task *t; | 593 | struct GNUNET_SCHEDULER_Task *t; |
590 | 594 | ||
591 | if (ready_count > 0) | 595 | if (ready_count > 0) |
592 | return GNUNET_OK; | 596 | return GNUNET_YES; |
593 | for (t = pending_head; NULL != t; t = t->next) | 597 | for (t = pending_head; NULL != t; t = t->next) |
594 | if (t->lifeness == GNUNET_YES) | 598 | if (t->lifeness == GNUNET_YES) |
595 | return GNUNET_OK; | 599 | return GNUNET_YES; |
596 | for (t = shutdown_head; NULL != t; t = t->next) | 600 | for (t = shutdown_head; NULL != t; t = t->next) |
597 | if (t->lifeness == GNUNET_YES) | 601 | if (t->lifeness == GNUNET_YES) |
598 | return GNUNET_OK; | 602 | return GNUNET_YES; |
599 | for (t = pending_timeout_head; NULL != t; t = t->next) | 603 | for (t = pending_timeout_head; NULL != t; t = t->next) |
600 | if (t->lifeness == GNUNET_YES) | 604 | if (t->lifeness == GNUNET_YES) |
601 | return GNUNET_OK; | 605 | return GNUNET_YES; |
602 | if (NULL != shutdown_head) | 606 | if (NULL != shutdown_head) |
603 | { | 607 | { |
604 | GNUNET_SCHEDULER_shutdown (); | 608 | GNUNET_SCHEDULER_shutdown (); |
605 | return GNUNET_OK; | 609 | return GNUNET_YES; |
606 | } | 610 | } |
607 | return GNUNET_NO; | 611 | return GNUNET_NO; |
608 | } | 612 | } |