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
redis
Commits
b3bdcd22
Unverified
Commit
b3bdcd22
authored
Feb 05, 2021
by
filipe oliveira
Committed by
GitHub
Feb 05, 2021
Browse files
Fix compiler warning on implicit declaration of ‘nanosleep’ . Removed unused variable (#8454)
parent
18ac4197
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/modules/blockonbackground.c
View file @
b3bdcd22
#define REDISMODULE_EXPERIMENTAL_API
#define REDISMODULE_EXPERIMENTAL_API
#define _XOPEN_SOURCE 700
#include "redismodule.h"
#include "redismodule.h"
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -55,7 +56,7 @@ void *BlockDebug_ThreadMain(void *arg) {
...
@@ -55,7 +56,7 @@ void *BlockDebug_ThreadMain(void *arg) {
}
}
/* The thread entry point that actually executes the blocking part
/* The thread entry point that actually executes the blocking part
* of the command BLOCK.DEBUG. */
* of the command BLOCK.
DOUBLE_
DEBUG. */
void
*
DoubleBlock_ThreadMain
(
void
*
arg
)
{
void
*
DoubleBlock_ThreadMain
(
void
*
arg
)
{
void
**
targ
=
arg
;
void
**
targ
=
arg
;
RedisModuleBlockedClient
*
bc
=
targ
[
0
];
RedisModuleBlockedClient
*
bc
=
targ
[
0
];
...
@@ -173,14 +174,13 @@ int HelloBlockNoTracking_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **a
...
@@ -173,14 +174,13 @@ int HelloBlockNoTracking_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **a
int
HelloDoubleBlock_RedisCommand
(
RedisModuleCtx
*
ctx
,
RedisModuleString
**
argv
,
int
argc
)
{
int
HelloDoubleBlock_RedisCommand
(
RedisModuleCtx
*
ctx
,
RedisModuleString
**
argv
,
int
argc
)
{
if
(
argc
!=
2
)
return
RedisModule_WrongArity
(
ctx
);
if
(
argc
!=
2
)
return
RedisModule_WrongArity
(
ctx
);
long
long
delay
;
long
long
delay
;
long
long
timeout
;
if
(
RedisModule_StringToLongLong
(
argv
[
1
],
&
delay
)
!=
REDISMODULE_OK
)
{
if
(
RedisModule_StringToLongLong
(
argv
[
1
],
&
delay
)
!=
REDISMODULE_OK
)
{
return
RedisModule_ReplyWithError
(
ctx
,
"ERR invalid count"
);
return
RedisModule_ReplyWithError
(
ctx
,
"ERR invalid count"
);
}
}
pthread_t
tid
;
pthread_t
tid
;
RedisModuleBlockedClient
*
bc
=
RedisModule_BlockClient
(
ctx
,
HelloBlock_Reply
,
HelloBlock_Timeout
,
HelloBlock_FreeData
,
timeout
);
RedisModuleBlockedClient
*
bc
=
RedisModule_BlockClient
(
ctx
,
HelloBlock_Reply
,
HelloBlock_Timeout
,
HelloBlock_FreeData
,
0
);
/* Now that we setup a blocking client, we need to pass the control
/* Now that we setup a blocking client, we need to pass the control
* to the thread. However we need to pass arguments to the thread:
* to the thread. However we need to pass arguments to the thread:
...
...
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