-/* Thread to do the housekeeping. */
-static void *
-housekeeping_thread (void *arg)
-{
- static int sentinel;
-
- (void)arg;
-
- if (sentinel)
- {
- log_info ("housekeeping is already going on\n");
- return NULL;
- }
- sentinel++;
- if (opt.verbose > 1)
- log_info ("starting housekeeping\n");
-
- if (opt.verbose > 1)
- log_info ("ready with housekeeping\n");
- sentinel--;
- return NULL;
-
-}
-
-
-#if GPGRT_GCC_HAVE_PUSH_PRAGMA
-# pragma GCC push_options
-# pragma GCC optimize ("no-strict-overflow")
-#endif
-static int
-time_for_housekeeping_p (time_t curtime)
-{
- static time_t last_housekeeping;
-
- if (!last_housekeeping)
- last_housekeeping = curtime;
-
- if (last_housekeeping + HOUSEKEEPING_INTERVAL <= curtime
- || last_housekeeping > curtime /*(be prepared for y2038)*/)
- {
- last_housekeeping = curtime;
- return 1;
- }
- return 0;
-}
-#if GPGRT_GCC_HAVE_PUSH_PRAGMA
-# pragma GCC pop_options
-#endif
-
-
-/* This is the worker for the ticker. It is called every few seconds
- and may only do fast operations. */
-static void
-handle_tick (void)
-{
- if (time_for_housekeeping_p (gnupg_get_time ()))
- {
- npth_t thread;
- npth_attr_t tattr;
- int err;
-
- err = npth_attr_init (&tattr);
- if (err)
- log_error ("error preparing housekeeping thread: %s\n", strerror (err));
- else
- {
- npth_attr_setdetachstate (&tattr, NPTH_CREATE_DETACHED);
- err = npth_create (&thread, &tattr, housekeeping_thread, NULL);
- if (err)
- log_error ("error spawning housekeeping thread: %s\n",
- strerror (err));
- npth_attr_destroy (&tattr);
- }
- }
-}
-
-