mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-27 11:40:43 +00:00
Reverse christmas tree and simplify a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
d4096c8c0c
commit
2a709f739d
9 files changed
+23
-23
No files matched your search
+1
-1
@@ -38,8 +38,8 @@ static void cb(uev_t *w, void *arg, int events)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uev_ctx_t ctx;
|
||||
struct timeval tomorrow;
|
||||
uev_ctx_t ctx;
|
||||
|
||||
gettimeofday(&tomorrow, NULL);
|
||||
tomorrow.tv_sec += 24 * 60 * 60;
|
||||
|
||||
+4
-4
@@ -33,8 +33,8 @@ struct timeval tv;
|
||||
|
||||
static void cron_job(uev_t *w, void *arg, int events)
|
||||
{
|
||||
static int laps = 3;
|
||||
struct timeval now;
|
||||
static int laps = 3;
|
||||
|
||||
if (UEV_ERROR == events)
|
||||
fprintf(stderr, "cron watcher failed, ignoring ...\n");
|
||||
@@ -54,10 +54,10 @@ static void cron_job(uev_t *w, void *arg, int events)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int rc;
|
||||
uev_t cron_watcher;
|
||||
uev_ctx_t ctx;
|
||||
time_t when, interval;
|
||||
uev_t cron;
|
||||
int rc;
|
||||
|
||||
uev_init(&ctx);
|
||||
|
||||
@@ -68,7 +68,7 @@ int main(void)
|
||||
printf("Expected cron %s", ctime(&when));
|
||||
|
||||
interval = INTERVAL;
|
||||
uev_cron_init(&ctx, &cron_watcher, cron_job, NULL, when, interval);
|
||||
uev_cron_init(&ctx, &cron, cron_job, NULL, when, interval);
|
||||
|
||||
rc = uev_run(&ctx, 0);
|
||||
fail_unless(result == 0);
|
||||
|
||||
+3
-3
@@ -81,8 +81,8 @@ static void sigchld_cb(uev_t *w, void *arg, int events)
|
||||
|
||||
static void work_cb(uev_t *w, void *arg, int events)
|
||||
{
|
||||
int status = 0;
|
||||
pid_t pid;
|
||||
pid_t pid;
|
||||
int status = 0;
|
||||
|
||||
pid = fork();
|
||||
if (-1 == pid)
|
||||
@@ -113,8 +113,8 @@ static void exit_cb(uev_t *w, void *arg, int events)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
uev_t sigsegv_watcher, sigchld_watcher, timeout_watcher, deadline_watcher;
|
||||
uev_ctx_t ctx;
|
||||
uev_t sigsegv_watcher, sigchld_watcher, timeout_watcher, deadline_watcher;
|
||||
|
||||
/* Initialize libuEv */
|
||||
uev_init(&ctx);
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ static void cb(uev_t *w, void *arg, int events)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int rc;
|
||||
uev_t w;
|
||||
uev_ctx_t ctx;
|
||||
uev_t w;
|
||||
int rc;
|
||||
|
||||
uev_init(&ctx);
|
||||
uev_timer_init(&ctx, &w, cb, NULL, TIMEOUT * 1000, 0);
|
||||
|
||||
Reference in new issue
Block a user