-
Notifications
You must be signed in to change notification settings - Fork 231
single writer threadpool #1565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
single writer threadpool #1565
Conversation
src/commands/cmd_context.c
Outdated
tid = thpool_num_threads(_thpool); | ||
} else { | ||
// +1 to compensate for Redis main thread | ||
tid = thpool_get_thread_id(_thpool, pthread_self()) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU
for a pool with size 1
the reader thread will get tid=1
which is also thpool_num_threads
is it a problem here?
src/slow_log/slow_log.c
Outdated
@@ -13,14 +13,24 @@ | |||
#include "../util/rmalloc.h" | |||
#include "../util/thpool/thpool.h" | |||
|
|||
extern threadpool _readers_thpool; // declared in module.c | |||
extern threadpool _writers_thpool; // declared in module.c | |||
|
|||
static int get_thread_id() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add explanatory comment like:
/* get_thread_id returns 0 for the Redis main thread,
* reader thread count + 1 for the writer thread,
* or reader thread ID for a reader thread. */
We should consider relocating this function to thpool.c
, since it gets invoked here and by command_ctx.c
(though thankfully nowhere else).
40e2891
20a865b
to
2ec0eb2
Compare
09a0612
to
176eacd
Compare
* single writer threadpool * name read and writer threads * maintain both readers and writers thread pools under a single pools object
* single writer threadpool * name read and writer threads * maintain both readers and writers thread pools under a single pools object
No description provided.