#include "istream.h"
#include "write-full.h"
#include "master-service.h"
+#include "sleep.h"
#include "doveadm.h"
#include "doveadm-print.h"
if (signo == SIGTERM) {
/* wait for a while for the process to die */
- usleep(1000);
+ i_sleep_msecs(1);
for (i = 0; i < 30; i++) {
if (kill(pid, 0) < 0) {
if (errno != ESRCH)
i_error("kill() failed: %m");
break;
}
- usleep(100000);
+ i_sleep_msecs(100);
}
}
}
#include "istream-chain.h"
#include "ostream.h"
#include "time-util.h"
+#include "sleep.h"
#include "connection.h"
#include "test-common.h"
#include "http-url.h"
"\r\n"
"Everything is OK\r\n";
- usleep(200000);
+ i_sleep_msecs(200);
o_stream_nsend_str(conn->conn.output, resp);
server_connection_deinit(&conn);
}
/* parent: client */
- usleep(100000); /* wait a little for server setup */
+ i_sleep_msecs(100); /* wait a little for server setup */
ioloop = io_loop_create();
test_client_run(client_test, client_set);
#include "istream.h"
#include "ostream.h"
#include "time-util.h"
+#include "sleep.h"
#include "connection.h"
#include "test-common.h"
#include "http-url.h"
if (debug)
i_debug("client[%d]: PID=%s", i+1, my_pid);
/* child: client */
- usleep(100000); /* wait a little for server setup */
+ /* wait a little for server setup */
+ i_sleep_msecs(100);
i_close_fd(&fd_listen);
ioloop = io_loop_create();
client_test(i);
#include "ostream.h"
#include "ioloop.h"
#include "unlink-directory.h"
+#include "sleep.h"
#include "test-common.h"
#include "imapc-client-private.h"
}
/* parent: client */
- usleep(100000); /* wait a little for server setup */
+ i_sleep_msecs(100); /* wait a little for server setup */
ioloop = io_loop_create();
imapc_client = imapc_client_init(&client_set_copy);
#include "time-util.h"
#include "lib-event-private.h"
#include "str.h"
+#include "sleep.h"
#include "ioloop.h"
#include "connection.h"
#include "ostream.h"
i_fatal("gettimeofday() failed %m");
}
while (access(signal_file, F_OK) < 0) {
- usleep(10000);
+ i_sleep_msecs(10);
if (gettimeofday(&now, NULL) < 0) {
kill_stats_child();
i_fatal("gettimeofday() failed %m");
#include "istream-failure-at.h"
#include "ostream.h"
#include "time-util.h"
+#include "sleep.h"
#include "connection.h"
#include "test-common.h"
#include "smtp-client.h"
/* parent: client */
- usleep(100000); /* wait a little for server setup */
+ i_sleep_msecs(100); /* wait a little for server setup */
lib_signals_ignore(SIGPIPE, TRUE);
ioloop = io_loop_create();
#include "istream.h"
#include "ostream.h"
#include "time-util.h"
+#include "sleep.h"
#include "connection.h"
#include "test-common.h"
#include "smtp-address.h"
if (debug)
i_debug("PID=%s", my_pid);
/* child: client */
- usleep(100000); /* wait a little for server setup */
+ /* wait a little for server setup */
+ i_sleep_msecs(100);
i_close_fd(&fd_listen);
ioloop = io_loop_create();
client_test(i);
#include "istream-chain.h"
#include "ostream.h"
#include "time-util.h"
+#include "sleep.h"
#include "unlink-directory.h"
#include "write-full.h"
#include "connection.h"
/* parent: client */
- usleep(100000); /* wait a little for server setup */
+ i_sleep_msecs(100); /* wait a little for server setup */
server_port = 0;
ioloop = io_loop_create();
#include "str.h"
#include "read-full.h"
#include "write-full.h"
+#include "sleep.h"
#include "message-date.h"
#include "istream-raw-mbox.h"
#include "mbox-storage.h"
performance problem and the consequences of being wrong are
quite minimal (an extra logged error message). */
while (sync_ctx->orig_mtime == st->st_mtime) {
- usleep(500000);
+ i_sleep_msecs(500);
if (utime(mailbox_get_path(&sync_ctx->mbox->box), NULL) < 0) {
mbox_set_syscall_error(sync_ctx->mbox,
"utime()");
#include "hex-binary.h"
#include "hostpid.h"
#include "randgen.h"
+#include "sleep.h"
#include "unlink-directory.h"
#include "mailbox-list-private.h"
#include "mailbox-list-delete.h"
lying around. In case it's .nfs* files, retry after
waiting a bit. Hopefully all processes keeping those
files open will have closed them by then. */
- usleep(100000);
+ i_sleep_msecs(100);
ret = rmdir(path);
}
if (rmdir(path) == 0)
#include "safe-mkstemp.h"
#include "nfs-workarounds.h"
#include "file-dotlock.h"
+#include "sleep.h"
#include <stdio.h>
#include <signal.h>
otherwise another process might try to override it at the same time
and unlink our newly created dotlock. */
if (lock_info->use_io_notify)
- usleep(LOCK_RANDOM_USLEEP_TIME);
+ i_sleep_usecs(LOCK_RANDOM_USLEEP_TIME);
return 0;
}
struct timeout *to;
if (!lock_info->use_io_notify) {
- usleep(lock_info->wait_usecs);
+ i_sleep_usecs(lock_info->wait_usecs);
return;
}
/* listening for files not supported */
io_loop_destroy(&ioloop);
lock_info->use_io_notify = FALSE;
- usleep(LOCK_RANDOM_USLEEP_TIME);
+ i_sleep_usecs(LOCK_RANDOM_USLEEP_TIME);
return;
}
/* timeout after a random time even when using notify, since it
#include "lib.h"
#include "array.h"
+#include "sleep.h"
#include "ioloop-private.h"
#include "ioloop-iolist.h"
/* no I/Os, but we should have some timeouts.
just wait for them. */
i_assert(msecs >= 0);
- usleep(msecs*1000);
+ i_sleep_intr_msecs(msecs);
ret = 0;
}
#ifdef IOLOOP_KQUEUE
#include "array.h"
+#include "sleep.h"
#include "ioloop-private.h"
#include <unistd.h>
}
} else {
i_assert(msecs >= 0);
- usleep(msecs * 1000);
+ i_sleep_intr_msecs(msecs);
ret = 0;
}
#include "test-lib.h"
#include "unlink-directory.h"
#include "file-create-locked.h"
+#include "sleep.h"
#include <fcntl.h>
#include <signal.h>
return FALSE;
i_fatal("kill(SIGSRCH) failed: %m");
}
- usleep(10000);
+ i_sleep_msecs(10);
}
i_error("%s isn't being created", path);
return FALSE;
#include "str.h"
#include "safe-mkstemp.h"
#include "time-util.h"
+#include "sleep.h"
#include "master-client.h"
#include "service.h"
#include "service-process.h"
if (finished ||
timeval_diff_msecs(&ioloop_timeval, &tv_start) > MAX_DIE_WAIT_MSECS)
break;
- usleep(100000);
+ i_sleep_msecs(100);
}
}
if (service_list_processes_close_listeners(service_list)) {
/* SIGQUITs were sent. wait a little bit to make sure they're
also processed before quitting. */
- usleep(1000000);
+ i_sleep_msecs(1000);
}
}