mirror of
https://github.com/wassname/ray.git
synced 2026-07-27 11:26:41 +08:00
fix compiler warning for linux
This commit is contained in:
+2
-2
@@ -48,8 +48,8 @@ int64_t event_loop_add_timer(event_loop *loop,
|
||||
return aeCreateTimeEvent(loop, milliseconds, handler, context, NULL);
|
||||
}
|
||||
|
||||
void event_loop_remove_timer(event_loop *loop, int64_t id) {
|
||||
int err = aeDeleteTimeEvent(loop, id);
|
||||
void event_loop_remove_timer(event_loop *loop, timer_id timer_id) {
|
||||
int err = aeDeleteTimeEvent(loop, timer_id);
|
||||
CHECK(err == AE_OK); /* timer id found? */
|
||||
}
|
||||
|
||||
|
||||
+12
-9
@@ -4,6 +4,8 @@
|
||||
#include <stdint.h>
|
||||
#include "ae/ae.h"
|
||||
|
||||
typedef long long timer_id;
|
||||
|
||||
typedef aeEventLoop event_loop;
|
||||
|
||||
/* File descriptor is readable. */
|
||||
@@ -12,6 +14,9 @@ typedef aeEventLoop event_loop;
|
||||
/* File descriptor is writable. */
|
||||
#define EVENT_LOOP_WRITE AE_WRITABLE
|
||||
|
||||
/* Constant specifying that the timer is done and it will be removed. */
|
||||
#define EVENT_LOOP_TIMER_DONE AE_NOMORE
|
||||
|
||||
/* Signature of the handler that will be called when there is a new event
|
||||
* on the file descriptor that this handler has been registered for. The
|
||||
* context is the one that was passed into add_file by the user. The
|
||||
@@ -24,10 +29,12 @@ typedef void (*event_loop_file_handler)(event_loop *loop,
|
||||
|
||||
/* This handler will be called when a timer times out. The id of the timer
|
||||
* as well as the context that was specified when registering this handler
|
||||
* are passed as arguments. */
|
||||
typedef int64_t (*event_loop_timer_handler)(event_loop *loop,
|
||||
int64_t id,
|
||||
void *context);
|
||||
* are passed as arguments. The return is the number of milliseconds the
|
||||
* timer shall be reset to or EVENT_LOOP_TIMER_DONE if the timer shall
|
||||
* not triggered again. */
|
||||
typedef int (*event_loop_timer_handler)(event_loop *loop,
|
||||
timer_id timer_id,
|
||||
void *context);
|
||||
|
||||
/* Create and return a new event loop. */
|
||||
event_loop *event_loop_create();
|
||||
@@ -58,12 +65,8 @@ int64_t event_loop_add_timer(event_loop *loop,
|
||||
event_loop_timer_handler handler,
|
||||
void *context);
|
||||
|
||||
/* Reset the timer timeout to a given number of milliseconds.
|
||||
* NOTE: This is not implemented yet. */
|
||||
void event_loop_reset_timer(event_loop *loop, int64_t id, int64_t milliseconds);
|
||||
|
||||
/* Remove a registered time event handler from the event loop. */
|
||||
void event_loop_remove_timer(event_loop *loop, int64_t id);
|
||||
void event_loop_remove_timer(event_loop *loop, timer_id timer_id);
|
||||
|
||||
/* Run the event loop. */
|
||||
void event_loop_run(event_loop *loop);
|
||||
|
||||
@@ -12,7 +12,7 @@ static const char *log_fmt =
|
||||
|
||||
struct ray_logger_impl {
|
||||
/* String that identifies this client type. */
|
||||
char *client_type;
|
||||
const char *client_type;
|
||||
/* Suppress all log messages below this level. */
|
||||
int log_level;
|
||||
/* Whether or not we have a direct connection to Redis. */
|
||||
|
||||
+2
-2
@@ -38,9 +38,9 @@ void test_callback(object_id object_id,
|
||||
free(manager_vector);
|
||||
}
|
||||
|
||||
int64_t timeout_handler(event_loop *loop, int64_t id, void *context) {
|
||||
int timeout_handler(event_loop *loop, timer_id timer_id, void *context) {
|
||||
event_loop_stop(loop);
|
||||
return -1;
|
||||
return EVENT_LOOP_TIMER_DONE;
|
||||
}
|
||||
|
||||
TEST object_table_lookup_test(void) {
|
||||
|
||||
+2
-2
@@ -86,9 +86,9 @@ void redis_accept_callback(event_loop *loop,
|
||||
context);
|
||||
}
|
||||
|
||||
int64_t timeout_handler(event_loop *loop, int64_t id, void *context) {
|
||||
int timeout_handler(event_loop *loop, timer_id timer_id, void *context) {
|
||||
event_loop_stop(loop);
|
||||
return -1;
|
||||
return EVENT_LOOP_TIMER_DONE;
|
||||
}
|
||||
|
||||
TEST async_redis_socket_test(void) {
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ TEST send_task(void) {
|
||||
*task_return(task, 1) = globally_unique_id();
|
||||
int fd[2];
|
||||
socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
|
||||
write_message(fd[0], SUBMIT_TASK, task_size(task), task);
|
||||
write_message(fd[0], SUBMIT_TASK, task_size(task), (uint8_t*) task);
|
||||
int64_t type;
|
||||
int64_t length;
|
||||
uint8_t *message;
|
||||
|
||||
Reference in New Issue
Block a user