Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
a5e0de0d
Commit
a5e0de0d
authored
Jul 10, 2013
by
Pieter Noordhuis
Browse files
Merge branch 'example-ae'
parents
bcf83543
af9bf169
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
a5e0de0d
...
...
@@ -73,7 +73,7 @@ hiredis-example-ae:
@
false
else
hiredis-example-ae
:
example-ae.c adapters/ae.h $(STLIBNAME)
$(CC)
-o
$@
$(REAL_CFLAGS)
$(REAL_LDFLAGS)
-I
$(AE_DIR)
$(AE_DIR)
/ae.o
$(AE_DIR)
/zmalloc.o example-ae.c
$(STLIBNAME)
$(CC)
-o
$@
$(REAL_CFLAGS)
$(REAL_LDFLAGS)
-I
$(AE_DIR)
$(AE_DIR)
/ae.o
$(AE_DIR)
/zmalloc.o
$(AE_DIR)
/../deps/jemalloc/lib/libjemalloc.a
-pthread
example-ae.c
$(STLIBNAME)
endif
hiredis-%
:
%.o $(STLIBNAME)
...
...
example-ae.c
View file @
a5e0de0d
...
...
@@ -21,17 +21,22 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) {
void
connectCallback
(
const
redisAsyncContext
*
c
,
int
status
)
{
if
(
status
!=
REDIS_OK
)
{
printf
(
"Error: %s
\n
"
,
c
->
errstr
);
aeStop
(
loop
);
return
;
}
printf
(
"Connected...
\n
"
);
}
void
disconnectCallback
(
const
redisAsyncContext
*
c
,
int
status
)
{
if
(
status
!=
REDIS_OK
)
{
printf
(
"Error: %s
\n
"
,
c
->
errstr
);
aeStop
(
loop
);
return
;
}
printf
(
"Disconnected...
\n
"
);
aeStop
(
loop
);
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -44,7 +49,7 @@ int main (int argc, char **argv) {
return
1
;
}
loop
=
aeCreateEventLoop
();
loop
=
aeCreateEventLoop
(
64
);
redisAeAttach
(
loop
,
c
);
redisAsyncSetConnectCallback
(
c
,
connectCallback
);
redisAsyncSetDisconnectCallback
(
c
,
disconnectCallback
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment