summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cf87283)
raw | patch | inline | side by side (parent: cf87283)
author | Jan Andres <jan.andres@berenberg.de> | |
Wed, 21 Oct 2015 11:50:43 +0000 (13:50 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Sun, 8 Nov 2015 16:12:34 +0000 (17:12 +0100) |
Some plugins such as "network" create own threads from within their
init callbacks which can then start submitting data to the queue
right away, even if the read threads haven't been started yet.
If write threads are started before plugin initialization, this can
result in a race where a plugin's write callback gets called before
that plugin's init callback has completed.
To fix this, delay starting the write threads until after all plugins
have been initialized.
init callbacks which can then start submitting data to the queue
right away, even if the read threads haven't been started yet.
If write threads are started before plugin initialization, this can
result in a race where a plugin's write callback gets called before
that plugin's init callback has completed.
To fix this, delay starting the write threads until after all plugins
have been initialized.
src/plugin.c | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 97352c4778d28f88c796101d5be082bcef0bbb48..6d3d3c9520ac770e4d098475b9c9a22ab14ce8c4 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
write_threads_num = 5;
}
- start_write_threads ((size_t) write_threads_num);
-
if ((list_init == NULL) && (read_heap == NULL))
return;
le = le->next;
}
+ start_write_threads ((size_t) write_threads_num);
+
/* Start read-threads */
if (read_heap != NULL)
{