diff --git a/obexd/src/main.c b/obexd/src/main.c
index 40f0099..d492ad7 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
const char *capability = DEFAULT_CAP_FILE;
const char *devnode = NULL;
+#ifdef NEED_THREADS
+ if (g_thread_supported() == FALSE)
+ g_thread_init(NULL);
+#endif
+
while ((opt = getopt_long(argc, argv, "+ndhofr:c:t:a", options, NULL)) != EOF) {
switch(opt) {
case 'n':
main_loop = g_main_loop_new(NULL, FALSE);
+#ifdef NEED_THREADS
+ if (dbus_threads_init_default() == FALSE) {
+ fprintf(stderr, "Can't init usage of threads\n");
+ exit(1);
+ }
+#endif
+
dbus_error_init(&err);
conn = g_dbus_setup_bus(DBUS_BUS_SESSION, OPENOBEX_SERVICE, &err);