mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
agent: Reduce sleep time in the progress callback.
* agent/gpg-agent.c (agent_libgcrypt_progress_cb): Reduce sleep time from 100ms to 1ms or use gpgrt_yield when build against a recent libgpg-error. -- Debian-bug-id: 851298 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
2312248b2e
commit
3d356d165a
@ -1763,11 +1763,19 @@ agent_libgcrypt_progress_cb (void *data, const char *what, int printchar,
|
|||||||
|
|
||||||
/* Libgcrypt < 1.8 does not know about nPth and thus when it reads
|
/* Libgcrypt < 1.8 does not know about nPth and thus when it reads
|
||||||
* from /dev/random this will block the process. To mitigate this
|
* from /dev/random this will block the process. To mitigate this
|
||||||
* problem we take a short nap when Libgcrypt tells us that it needs
|
* problem we yield the thread when Libgcrypt tells us that it needs
|
||||||
* more entropy. This way other threads have chance to run. */
|
* more entropy. This way other threads have chance to run. */
|
||||||
#if GCRYPT_VERSION_NUMBER < 0x010800 /* 1.8.0 */
|
#if GCRYPT_VERSION_NUMBER < 0x010800 /* 1.8.0 */
|
||||||
if (what && !strcmp (what, "need_entropy"))
|
if (what && !strcmp (what, "need_entropy"))
|
||||||
npth_usleep (100000); /* 100ms */
|
{
|
||||||
|
#if GPGRT_VERSION_NUMBER < 0x011900 /* 1.25 */
|
||||||
|
/* In older gpg-error versions gpgrt_yield is buggy for use with
|
||||||
|
* nPth and thus we need to resort to a sleep call. */
|
||||||
|
npth_usleep (1000); /* 1ms */
|
||||||
|
#else
|
||||||
|
gpgrt_yield ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user