unix, windows: change timer intervals to uint64_t
This commit is contained in:
parent
d6bfedb862
commit
0cb9fbfe18
@ -487,8 +487,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
|
|||||||
|
|
||||||
#define UV_TIMER_PRIVATE_FIELDS \
|
#define UV_TIMER_PRIVATE_FIELDS \
|
||||||
RB_ENTRY(uv_timer_s) tree_entry; \
|
RB_ENTRY(uv_timer_s) tree_entry; \
|
||||||
int64_t due; \
|
uint64_t due; \
|
||||||
int64_t repeat; \
|
uint64_t repeat; \
|
||||||
uint64_t start_id; \
|
uint64_t start_id; \
|
||||||
uv_timer_cb timer_cb;
|
uv_timer_cb timer_cb;
|
||||||
|
|
||||||
|
|||||||
12
include/uv.h
12
include/uv.h
@ -1170,15 +1170,11 @@ UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle);
|
|||||||
*
|
*
|
||||||
* If repeat is non-zero, the callback fires first after timeout milliseconds
|
* If repeat is non-zero, the callback fires first after timeout milliseconds
|
||||||
* and then repeatedly after repeat milliseconds.
|
* and then repeatedly after repeat milliseconds.
|
||||||
*
|
|
||||||
* timeout and repeat are signed integers but that will change in a future
|
|
||||||
* version of libuv. Don't pass in negative values, you'll get a nasty surprise
|
|
||||||
* when that change becomes effective.
|
|
||||||
*/
|
*/
|
||||||
UV_EXTERN int uv_timer_start(uv_timer_t* handle,
|
UV_EXTERN int uv_timer_start(uv_timer_t* handle,
|
||||||
uv_timer_cb cb,
|
uv_timer_cb cb,
|
||||||
int64_t timeout,
|
uint64_t timeout,
|
||||||
int64_t repeat);
|
uint64_t repeat);
|
||||||
|
|
||||||
UV_EXTERN int uv_timer_stop(uv_timer_t* handle);
|
UV_EXTERN int uv_timer_stop(uv_timer_t* handle);
|
||||||
|
|
||||||
@ -1195,9 +1191,9 @@ UV_EXTERN int uv_timer_again(uv_timer_t* handle);
|
|||||||
* non-repeating before, it will have been stopped. If it was repeating, then
|
* non-repeating before, it will have been stopped. If it was repeating, then
|
||||||
* the old repeat value will have been used to schedule the next timeout.
|
* the old repeat value will have been used to schedule the next timeout.
|
||||||
*/
|
*/
|
||||||
UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, int64_t repeat);
|
UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat);
|
||||||
|
|
||||||
UV_EXTERN int64_t uv_timer_get_repeat(uv_timer_t* handle);
|
UV_EXTERN uint64_t uv_timer_get_repeat(uv_timer_t* handle);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -52,11 +52,8 @@ int uv_timer_init(uv_loop_t* loop, uv_timer_t* handle) {
|
|||||||
|
|
||||||
int uv_timer_start(uv_timer_t* handle,
|
int uv_timer_start(uv_timer_t* handle,
|
||||||
uv_timer_cb cb,
|
uv_timer_cb cb,
|
||||||
int64_t timeout,
|
uint64_t timeout,
|
||||||
int64_t repeat) {
|
uint64_t repeat) {
|
||||||
assert(timeout >= 0);
|
|
||||||
assert(repeat >= 0);
|
|
||||||
|
|
||||||
if (uv__is_active(handle))
|
if (uv__is_active(handle))
|
||||||
uv_timer_stop(handle);
|
uv_timer_stop(handle);
|
||||||
|
|
||||||
@ -97,13 +94,12 @@ int uv_timer_again(uv_timer_t* handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uv_timer_set_repeat(uv_timer_t* handle, int64_t repeat) {
|
void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) {
|
||||||
assert(repeat >= 0);
|
|
||||||
handle->repeat = repeat;
|
handle->repeat = repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int64_t uv_timer_get_repeat(uv_timer_t* handle) {
|
uint64_t uv_timer_get_repeat(uv_timer_t* handle) {
|
||||||
return handle->repeat;
|
return handle->repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,8 +87,8 @@ void uv_timer_endgame(uv_loop_t* loop, uv_timer_t* handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, int64_t timeout,
|
int uv_timer_start(uv_timer_t* handle, uv_timer_cb timer_cb, uint64_t timeout,
|
||||||
int64_t repeat) {
|
uint64_t repeat) {
|
||||||
uv_loop_t* loop = handle->loop;
|
uv_loop_t* loop = handle->loop;
|
||||||
uv_timer_t* old;
|
uv_timer_t* old;
|
||||||
|
|
||||||
@ -157,13 +157,13 @@ int uv_timer_again(uv_timer_t* handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uv_timer_set_repeat(uv_timer_t* handle, int64_t repeat) {
|
void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat) {
|
||||||
assert(handle->type == UV_TIMER);
|
assert(handle->type == UV_TIMER);
|
||||||
handle->repeat = repeat;
|
handle->repeat = repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int64_t uv_timer_get_repeat(uv_timer_t* handle) {
|
uint64_t uv_timer_get_repeat(uv_timer_t* handle) {
|
||||||
assert(handle->type == UV_TIMER);
|
assert(handle->type == UV_TIMER);
|
||||||
return handle->repeat;
|
return handle->repeat;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user