summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 32eb98c)
raw | patch | inline | side by side (parent: 32eb98c)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 14 Oct 2012 15:52:39 +0000 (17:52 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 14 Oct 2012 15:52:39 +0000 (17:52 +0200) |
This function copies the plugin context from the calling thread to the new
thread. While this might not strictly be necessary in most/many cases, this
will make sure that any code within a plugin uses the same context
information, thus avoiding possible problems in the future.
thread. While this might not strictly be necessary in most/many cases, this
will make sure that any code within a plugin uses the same context
information, thus avoiding possible problems in the future.
12 files changed:
src/amqp.c | patch | blob | history | |
src/dns.c | patch | blob | history | |
src/email.c | patch | blob | history | |
src/exec.c | patch | blob | history | |
src/gmond.c | patch | blob | history | |
src/ipmi.c | patch | blob | history | |
src/network.c | patch | blob | history | |
src/pinba.c | patch | blob | history | |
src/ping.c | patch | blob | history | |
src/python.c | patch | blob | history | |
src/rrdtool.c | patch | blob | history | |
src/unixsock.c | patch | blob | history |
diff --git a/src/amqp.c b/src/amqp.c
index 30a85810139fd489d2e440ad5e39fce220d1bbec..db65791626c69c0faf6b9e8feff87269a8f29f95 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
tmp = subscriber_threads + subscriber_threads_num;
memset (tmp, 0, sizeof (*tmp));
- status = pthread_create (tmp, /* attr = */ NULL,
+ status = plugin_thread_create (tmp, /* attr = */ NULL,
camqp_subscribe_thread, conf);
if (status != 0)
{
diff --git a/src/dns.c b/src/dns.c
index 08a036924b77d07bf1b4e3a0ec818ca1291e26c8..fe3b672a21d844b2190c80e7b2f7bffd9adb9b50 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
if (listen_thread_init != 0)
return (-1);
- status = pthread_create (&listen_thread, NULL, dns_child_loop,
+ status = plugin_thread_create (&listen_thread, NULL, dns_child_loop,
(void *) 0);
if (status != 0)
{
diff --git a/src/email.c b/src/email.c
index 8fc5509f3e7e5ece33a15015b0ffa40fde6d6ede..787f39170b2fc7402b1b8ca20405c8136e2e2a00 100644 (file)
--- a/src/email.c
+++ b/src/email.c
collectors[i] = (collector_t *)smalloc (sizeof (collector_t));
collectors[i]->socket = NULL;
- if (0 != (err = pthread_create (&collectors[i]->thread, &ptattr,
- collect, collectors[i]))) {
+ if (0 != (err = plugin_thread_create (&collectors[i]->thread,
+ &ptattr, collect, collectors[i]))) {
char errbuf[1024];
log_err ("pthread_create() failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
{
int err = 0;
- if (0 != (err = pthread_create (&connector, NULL,
+ if (0 != (err = plugin_thread_create (&connector, NULL,
open_connection, NULL))) {
char errbuf[1024];
disabled = 1;
diff --git a/src/exec.c b/src/exec.c
index 6dfdfe6a16b5ff357e689564cabcf3b9e3213053..da6e367d633dc3019849c65028c4ad89946dbb9f 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&t, &attr, exec_read_one, (void *) pl);
+ plugin_thread_create (&t, &attr, exec_read_one, (void *) pl);
} /* for (pl) */
return (0);
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_create (&t, &attr, exec_notification_one, (void *) pln);
+ plugin_thread_create (&t, &attr, exec_notification_one, (void *) pln);
} /* for (pl) */
return (0);
diff --git a/src/gmond.c b/src/gmond.c
index 3c746c48887c3e678d42e2417b3d11bd38a7b1ec..28be0920ccf51cd43731f9fd2e4549e780fe4ea5 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
mc_receive_thread_loop = 1;
- status = pthread_create (&mc_receive_thread_id, /* attr = */ NULL,
+ status = plugin_thread_create (&mc_receive_thread_id, /* attr = */ NULL,
mc_receive_thread, /* args = */ NULL);
if (status != 0)
{
diff --git a/src/ipmi.c b/src/ipmi.c
index 7eafea866240c9f790d9e5139a7eef6c096da1eb..fada5bdc3462a1d40396c9aa3fc4fe71f1dbe1e9 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
c_ipmi_active = 1;
- status = pthread_create (&thread_id, /* attr = */ NULL, thread_main,
+ status = plugin_thread_create (&thread_id, /* attr = */ NULL, thread_main,
/* user data = */ NULL);
if (status != 0)
{
diff --git a/src/network.c b/src/network.c
index 59c2be7c034c773778cfa546e00c42c240285374..369da94d63c8253a3d5ca6b1567421653d1e8202 100644 (file)
--- a/src/network.c
+++ b/src/network.c
if (dispatch_thread_running == 0)
{
int status;
- status = pthread_create (&dispatch_thread_id,
+ status = plugin_thread_create (&dispatch_thread_id,
NULL /* no attributes */,
dispatch_thread,
NULL /* no argument */);
if (receive_thread_running == 0)
{
int status;
- status = pthread_create (&receive_thread_id,
+ status = plugin_thread_create (&receive_thread_id,
NULL /* no attributes */,
receive_thread,
NULL /* no argument */);
diff --git a/src/pinba.c b/src/pinba.c
index a6fd06fe2d56352a0a7e29cba18b394dd32559d2..48a2431d9cbabf6f1994d43f43e80c112e701237 100644 (file)
--- a/src/pinba.c
+++ b/src/pinba.c
if (collector_thread_running)
return (0);
- status = pthread_create (&collector_thread_id,
+ status = plugin_thread_create (&collector_thread_id,
/* attrs = */ NULL,
collector_thread,
/* args = */ NULL);
diff --git a/src/ping.c b/src/ping.c
index b536f42966639f4d7e3ca260e238b7944440294f..417a7ac7912f29ffbca634aa75863dc5cbb23dff 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
ping_thread_loop = 1;
ping_thread_error = 0;
- status = pthread_create (&ping_thread_id, /* attr = */ NULL,
+ status = plugin_thread_create (&ping_thread_id, /* attr = */ NULL,
ping_thread, /* arg = */ (void *) 0);
if (status != 0)
{
diff --git a/src/python.c b/src/python.c
index 4a828b44c6352c6a3be8c5757b2cc6ddebafb96f..350bd14a34811a710c8d2245edeb1ff7cf017fe4 100644 (file)
--- a/src/python.c
+++ b/src/python.c
pthread_sigmask(SIG_BLOCK, &sigset, NULL);
state = PyEval_SaveThread();
if (do_interactive) {
- if (pthread_create(&thread, NULL, cpy_interactive, NULL)) {
+ if (plugin_thread_create(&thread, NULL, cpy_interactive, NULL)) {
ERROR("python: Error creating thread for interactive interpreter.");
}
}
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 56a82d0321b8a875fdc1a8b5c93e312550388b77..cac5c21b0617bf3b20e2cc3b8bb9b1d480116ea2 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
pthread_mutex_unlock (&cache_lock);
- status = pthread_create (&queue_thread, /* attr = */ NULL,
+ status = plugin_thread_create (&queue_thread, /* attr = */ NULL,
rrd_queue_thread, /* args = */ NULL);
if (status != 0)
{
diff --git a/src/unixsock.c b/src/unixsock.c
index d729477bbc54db999322dedfe581834dc9725c21..337978df444e17ac5dbccdbf88ad7d71330024fd 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
pthread_attr_init (&th_attr);
pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
- status = pthread_create (&th, &th_attr, us_handle_client, (void *) remote_fd);
+ status = plugin_thread_create (&th, &th_attr,
+ us_handle_client, (void *) remote_fd);
if (status != 0)
{
char errbuf[1024];
loop = 1;
- status = pthread_create (&listen_thread, NULL, us_server_thread, NULL);
+ status = plugin_thread_create (&listen_thread, NULL,
+ us_server_thread, NULL);
if (status != 0)
{
char errbuf[1024];