aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-03-17 05:23:10 +0000
committerNIIBE Yutaka <[email protected]>2020-04-02 05:11:52 +0000
commit3efe450ece2db30de202bd4d88f271ef93c50353 (patch)
tree11a81dfb8d50cd4c8f0fc9b181155bd10c5955a0
parentwatch: use condition variable. (diff)
downloadgnupg-3efe450ece2db30de202bd4d88f271ef93c50353.tar.gz
gnupg-3efe450ece2db30de202bd4d88f271ef93c50353.zip
watch: call notification to app_wait from scd_update_reader_status_file.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--scd/app.c11
-rw-r--r--scd/scdaemon.c3
-rw-r--r--scd/scdaemon.h1
3 files changed, 5 insertions, 10 deletions
diff --git a/scd/app.c b/scd/app.c
index da70f8705..aac9d304d 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -1937,6 +1937,7 @@ scd_update_reader_status_file (void)
{
card_t card, card_next;
int periodical_check_needed = 0;
+ int reported = 0;
npth_mutex_lock (&card_list_lock);
for (card = card_top; card; card = card_next)
@@ -1971,6 +1972,7 @@ scd_update_reader_status_file (void)
{
report_change (card->slot, card->card_status, status);
send_client_notifications (card, status == 0);
+ reported++;
if (status == 0)
{
@@ -1995,6 +1997,9 @@ scd_update_reader_status_file (void)
}
}
+ if (reported)
+ npth_cond_broadcast (&notify_cond);
+
npth_mutex_unlock (&card_list_lock);
return periodical_check_needed;
@@ -2292,12 +2297,6 @@ app_do_with_keygrip (ctrl_t ctrl, int action, const char *keygrip_str,
return c;
}
-void
-app_notify (void)
-{
- npth_cond_broadcast (&notify_cond);
-}
-
int
app_wait (void)
{
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 1f34809bc..b7bbc0361 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -1220,9 +1220,6 @@ scd_kick_the_loop (void)
log_error ("SetEvent for scd_kick_the_loop failed: %s\n",
gpg_strerror (gpg_error_from_syserror ()));
#endif
-
- /* Also, notify watching threads. */
- app_notify ();
}
/* Connection handler loop. Wait for connection requests and spawn a
diff --git a/scd/scdaemon.h b/scd/scdaemon.h
index c79c272a0..19f7e9d3f 100644
--- a/scd/scdaemon.h
+++ b/scd/scdaemon.h
@@ -154,6 +154,5 @@ int get_active_connection_count (void);
/*-- app.c --*/
int scd_update_reader_status_file (void);
int app_wait (void);
-void app_notify (void);
#endif /*SCDAEMON_H*/