diff --git a/CMakeLists.txt b/CMakeLists.txt index 79522fa9..1b052e9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,6 +152,8 @@ endif() # which doesn't seem to exist; but we only need -lmatio, so force it here set(MATIO_LIBRARIES -lmatio) +find_library(PTHREAD_LIBRARIES pthread) +message("PTHREAD " ${PTHREAD_LIBRARIES}) set(LIBOSC_LIBS ${GLIB_LIBRARIES} ${GLIBCONFIG_LIBRARIES} @@ -168,6 +170,7 @@ set(LIBOSC_LIBS ${LIBAD9361_LIBRARIES} ${LIBAD9166_LIBRARIES} dl + ${PTHREAD_LIBRARIES} ) configure_file(config.h.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) @@ -246,6 +249,7 @@ target_link_libraries(oscmain PRIVATE ${GTK_LIBRARIES} ${LIBIIO_LIBRARIES} osc + ${PTHREAD_LIBRARIES} ) set_target_properties(oscmain PROPERTIES OUTPUT_NAME osc) diff --git a/dialogs.c b/dialogs.c index 527c47af..38de865d 100644 --- a/dialogs.c +++ b/dialogs.c @@ -498,19 +498,20 @@ static void refresh_usb(void) if (!ctxs) goto nope; -#ifdef __APPLE__ - // Scanning seems to be broken at the moment - goto nope; -#endif - - + printf("filter%s\n", filter); + pthread_mutex_t lock; + printf("pthread_mutex_init%s\n", filter); + pthread_mutex_init(&lock, NULL); + printf("pthread_mutex_initialized%s\n", filter); ret = iio_scan_context_get_info_list(ctxs, &info); + printf("ret%d\n", (int)ret); if (ret < 0) goto err_free_ctxs; if (!ret) goto err_free_info_list; for (i = 0; i < (size_t) ret; i++) { + printf("info ctx%s\n", iio_context_info_get_description(info[i])); tmp = strdup(iio_context_info_get_description(info[i])); pid = strdup(iio_context_info_get_description(info[i])); diff --git a/osc.c b/osc.c index a9b7da3b..f7c92a11 100644 --- a/osc.c +++ b/osc.c @@ -736,6 +736,7 @@ int plugin_data_capture_of_plot(OscPlot *plot, const char *device, gfloat ***coo osc_plot_set_markers_copy(plot, *markers_cp); /* Wait til the copy is complete */ + printf("g_mutex_lock\n"); g_mutex_lock(markers_lock); /* if the lock is released, but the copy is still here diff --git a/oscplot.c b/oscplot.c index bf93e81d..d25e26f8 100644 --- a/oscplot.c +++ b/oscplot.c @@ -1247,6 +1247,7 @@ static void do_fft(Transform *tr) sizeof(struct marker_type) * MAX_MARKERS); *settings->markers_copy = NULL; g_mutex_unlock(settings->marker_lock); + printf("g_mutex_unlock"); } } } @@ -1679,6 +1680,7 @@ bool cross_correlation_transform_function(Transform *tr, gboolean init_transform sizeof(struct marker_type) * MAX_MARKERS); *settings->markers_copy = NULL; g_mutex_unlock(settings->marker_lock); + printf("g_mutex_unlock"); } } @@ -1758,6 +1760,7 @@ bool freq_spectrum_transform_function(Transform *tr, gboolean init_transform) sizeof(struct marker_type) * MAX_MARKERS); *settings->markers_copy = NULL; g_mutex_unlock(settings->marker_lock); + printf("g_mutex_unlock"); } } @@ -3523,6 +3526,7 @@ static void capture_button_clicked_cb(GtkToggleToolButton *btn, gpointer data) g_mutex_trylock(&priv->g_marker_copy_lock); g_mutex_unlock(&priv->g_marker_copy_lock); + printf("g_mutex_trylock g_mutex_unlock"); g_signal_emit(plot, oscplot_signals[CAPTURE_EVENT_SIGNAL], 0, button_state); } @@ -4410,6 +4414,7 @@ static void plot_destroyed (GtkWidget *object, OscPlot *plot) g_slist_free_full(plot->priv->ch_settings_list, (GDestroyNotify)g_free); g_mutex_trylock(&plot->priv->g_marker_copy_lock); g_mutex_unlock(&plot->priv->g_marker_copy_lock); + printf("g_mutex_trylock g_mutex_unlock"); g_signal_emit(plot, oscplot_signals[DESTROY_EVENT_SIGNAL], 0); }