File: timer.h

package info (click to toggle)
seafile 9.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,200 kB
  • sloc: ansic: 44,863; python: 6,601; sh: 272; makefile: 268; cpp: 93
file content (28 lines) | stat: -rw-r--r-- 756 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

#ifndef SEAF_TIMER_H
#define SEAF_TIMER_H

/* return TRUE to reschedule the timer, return FALSE to cancle the timer */
typedef int (*TimerCB) (void *data);

struct SeafTimer;

typedef struct SeafTimer SeafTimer;

/**
 * Calls timer_func(user_data) after the specified interval.
 * The timer is freed if timer_func returns zero.
 * Otherwise, it's called again after the same interval.
 */
SeafTimer* seaf_timer_new (TimerCB           func,
                           void             *user_data,
                           uint64_t          timeout_milliseconds);

/**
 * Frees a timer and sets the timer pointer to NULL.
 */
void seaf_timer_free (SeafTimer **timer);


#endif