On 9/16/19 1:45 PM, Daniel P. Berrangé wrote:
Neither virThreadInitialize or virThreadOnExit do anything since we
dropped the Win32 threads impl, in favour of win-pthreads.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/libvirt-admin.c | 3 +--
src/libvirt.c | 6 ++----
src/libvirt_private.syms | 1 -
src/locking/lock_daemon.c | 1 -
src/logging/log_daemon.c | 1 -
src/lxc/lxc_controller.c | 1 -
src/network/leaseshelper.c | 1 -
src/security/virt-aa-helper.c | 1 -
src/util/iohelper.c | 1 -
src/util/virthread.c | 10 ----------
src/util/virthread.h | 3 ---
tests/commandtest.c | 3 ---
tests/eventtest.c | 2 --
tests/qemuagenttest.c | 3 +--
tests/qemucapabilitiestest.c | 3 ---
tests/qemucaps2xmltest.c | 3 ---
tests/qemucapsprobe.c | 3 +--
tests/qemuhotplugtest.c | 3 +--
tests/qemumigparamstest.c | 3 +--
tests/qemumonitorjsontest.c | 3 +--
tests/seclabeltest.c | 3 ---
tests/testutils.c | 3 +--
tests/viratomictest.c | 3 ---
23 files changed, 9 insertions(+), 55 deletions(-)
diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index 9d5c5b1b7b..091473e698 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -52,8 +52,7 @@ virAdmGlobalInit(void)
* virAdmConnectOpen first. But we can't rely on VIR_DEBUG working
* until after initialization is complete, and since this is
* one-shot, we never get here again. */
- if (virThreadInitialize() < 0 ||
- virErrorInitialize() < 0)
+ if (virErrorInitialize() < 0)
goto error;
virLogSetFromEnv();
diff --git a/src/libvirt.c b/src/libvirt.c
index 15917cba6f..ca172beb71 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -243,8 +243,7 @@ virGlobalInit(void)
* virConnectOpen first. But we can't rely on VIR_DEBUG working
* until after initialization is complete, and since this is
* one-shot, we never get here again. */
- if (virThreadInitialize() < 0 ||
- virErrorInitialize() < 0)
+ if (virErrorInitialize() < 0)
goto error;
virFileActivateDirOverrideForLib();
@@ -369,8 +368,7 @@ DllMain(HINSTANCE instance ATTRIBUTE_UNUSED,
break;
case DLL_THREAD_DETACH:
- /* Release per-thread local data */
- virThreadOnExit();
+ /* Nothing todo in libvirt yet */
break;
Nit: this is the resulting code
case DLL_THREAD_ATTACH:
/* Nothing todo in libvirt yet */
break;
case DLL_THREAD_DETACH:
/* Nothing todo in libvirt yet */
break;
You can spare a few lines here:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
/* Nothing todo in libvirt yet */
break;
Reviewed-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
case DLL_PROCESS_DETACH:
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6619dbc2e9..da915876ff 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3173,7 +3173,6 @@ virRWLockWrite;
virThreadCancel;
virThreadCreateFull;
virThreadID;
-virThreadInitialize;
virThreadIsSelf;
virThreadJoin;
virThreadSelf;
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index edb61d74c0..a5a3a97e99 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -1124,7 +1124,6 @@ int main(int argc, char **argv) {
privileged = geteuid() == 0;
if (virGettextInitialize() < 0 ||
- virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 85c58aaa7b..9621702138 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -896,7 +896,6 @@ int main(int argc, char **argv) {
privileged = geteuid() == 0;
if (virGettextInitialize() < 0 ||
- virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c677eb8f6d..37851bf284 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -2505,7 +2505,6 @@ int main(int argc, char *argv[])
ns_fd[i] = -1;
if (virGettextInitialize() < 0 ||
- virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 5e04e16171..46482ad3ce 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -104,7 +104,6 @@ main(int argc, char **argv)
program_name = argv[0];
if (virGettextInitialize() < 0 ||
- virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), program_name);
exit(EXIT_FAILURE);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 326cfaf52a..ead4eaa236 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1421,7 +1421,6 @@ main(int argc, char **argv)
char *include_file = NULL;
if (virGettextInitialize() < 0 ||
- virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index ddc338b7c7..f3d45b9c03 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -196,7 +196,6 @@ main(int argc, char **argv)
program_name = argv[0];
if (virGettextInitialize() < 0 ||
- virThreadInitialize() < 0 ||
virErrorInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed"), program_name);
exit(EXIT_FAILURE);
diff --git a/src/util/virthread.c b/src/util/virthread.c
index 05b5572f5f..cdc5cab604 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -33,16 +33,6 @@
#include "virthreadjob.h"
-/* Nothing special required for pthreads */
-int virThreadInitialize(void)
-{
- return 0;
-}
-
-void virThreadOnExit(void)
-{
-}
-
int virOnce(virOnceControlPtr once, virOnceFunc init)
{
return pthread_once(&once->once, init);
diff --git a/src/util/virthread.h b/src/util/virthread.h
index 7870340c47..6bbc09fa13 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -82,9 +82,6 @@ struct virOnceControl {
typedef void (*virOnceFunc)(void);
-int virThreadInitialize(void) ATTRIBUTE_RETURN_CHECK;
-void virThreadOnExit(void);
-
typedef void (*virThreadFunc)(void *opaque);
#define virThreadCreate(thread, joinable, func, opaque) \
diff --git a/tests/commandtest.c b/tests/commandtest.c
index a382bb6dd2..c6fd826003 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -1292,9 +1292,6 @@ mymain(void)
int timer = -1;
int virinitret;
- if (virThreadInitialize() < 0)
- return EXIT_FAILURE;
-
if (chdir("/tmp") < 0)
return EXIT_FAILURE;
diff --git a/tests/eventtest.c b/tests/eventtest.c
index df7570bac6..f426469d21 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -321,8 +321,6 @@ mymain(void)
}
}
- if (virThreadInitialize() < 0)
- return EXIT_FAILURE;
char *debugEnv = getenv("LIBVIRT_DEBUG");
if (debugEnv && *debugEnv &&
(virLogSetDefaultPriority(virLogParseDefaultPriority(debugEnv)) < 0)) {
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index 91f19644d5..5ae098efa9 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -1431,8 +1431,7 @@ mymain(void)
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0 ||
- qemuTestDriverInit(&driver) < 0)
+ if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index 67f57a4fdc..1a785d8e39 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -214,9 +214,6 @@ mymain(void)
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0)
- return EXIT_FAILURE;
-
virEventRegisterDefaultImpl();
if (testQemuDataInit(&data) < 0)
diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c
index 3b381251a0..e36ba06eeb 100644
--- a/tests/qemucaps2xmltest.c
+++ b/tests/qemucaps2xmltest.c
@@ -203,9 +203,6 @@ mymain(void)
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0)
- return EXIT_FAILURE;
-
virEventRegisterDefaultImpl();
if (testQemuDataInit(&data) < 0)
diff --git a/tests/qemucapsprobe.c b/tests/qemucapsprobe.c
index ae016c47c2..36af01d561 100644
--- a/tests/qemucapsprobe.c
+++ b/tests/qemucapsprobe.c
@@ -54,8 +54,7 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
- if (virThreadInitialize() < 0 ||
- virInitialize() < 0) {
+ if (virInitialize() < 0) {
fprintf(stderr, "Failed to initialize libvirt");
return EXIT_FAILURE;
}
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index 3c177c6622..76b131295a 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -614,8 +614,7 @@ mymain(void)
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0 ||
- qemuTestDriverInit(&driver) < 0)
+ if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index dcefde2dbc..aacb905639 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -209,8 +209,7 @@ mymain(void)
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0 ||
- qemuTestDriverInit(&driver) < 0)
+ if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index af84e0ba04..d0bbb1f674 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -3019,8 +3019,7 @@ mymain(void)
return EXIT_AM_SKIP;
#endif
- if (virThreadInitialize() < 0 ||
- qemuTestDriverInit(&driver) < 0)
+ if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
virEventRegisterDefaultImpl();
diff --git a/tests/seclabeltest.c b/tests/seclabeltest.c
index a0296c787e..42dcb8c97f 100644
--- a/tests/seclabeltest.c
+++ b/tests/seclabeltest.c
@@ -11,9 +11,6 @@ mymain(void)
virSecurityManagerPtr mgr;
const char *doi, *model;
- if (virThreadInitialize() < 0)
- return EXIT_FAILURE;
-
mgr = virSecurityManagerNew(NULL, "QEMU",
VIR_SECURITY_MANAGER_DEFAULT_CONFINED);
if (mgr == NULL) {
fprintf(stderr, "Failed to start security driver");
diff --git a/tests/testutils.c b/tests/testutils.c
index 064460b4dc..1b663f9d5d 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -877,8 +877,7 @@ int virTestMain(int argc,
}
fprintf(stderr, "TEST: %s\n", progname);
- if (virThreadInitialize() < 0 ||
- virErrorInitialize() < 0)
+ if (virErrorInitialize() < 0)
return EXIT_FAILURE;
virLogSetFromEnv();
diff --git a/tests/viratomictest.c b/tests/viratomictest.c
index 52f17154e9..a933ab1cbd 100644
--- a/tests/viratomictest.c
+++ b/tests/viratomictest.c
@@ -164,9 +164,6 @@ mymain(void)
{
int ret = 0;
- if (virThreadInitialize() < 0)
- return -1;
-
if (virTestRun("types", testTypes, NULL) < 0)
ret = -1;
if (virTestRun("threads", testThreads, NULL) < 0)