Diff between 1985137b8d20858948ba83020b911f864bc7faad and 5787cb4e17af8c54c57b57f3161f9159cb9ef644

Changed Files

File Additions Deletions Status
obexd/src/main.c +12 -0 modified

Full Patch

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
@@ -178,6 +178,11 @@ int main(int argc, char *argv[])
 	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':
@@ -238,6 +243,13 @@ int main(int argc, char *argv[])
 
 	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);