PATTERN_ALL_HIGH,
};
-/* FIXME: Should not be global. */
-
-/* Private driver context. */
-struct drv_context {
- GSList *instances;
-};
-
/* Private, per-device-instance driver context. */
struct dev_context {
int pipe_fds[2];
struct drv_context *drvc;
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
- sr_err("fx2lafw: driver context malloc failed.");
- return SR_ERR;
+ sr_err("demo: driver context malloc failed.");
+ return SR_ERR_MALLOC;
}
ddi->priv = drvc;
40, receive_data, devc);
/* Run the demo thread. */
- g_thread_init(NULL);
- /* This must to be done between g_thread_init() & g_thread_create(). */
devc->timer = g_timer_new();
thread_running = 1;
- my_thread =
- g_thread_create((GThreadFunc)thread_func, devc, TRUE, NULL);
+ my_thread = g_thread_try_new("sigrok demo generator",
+ (GThreadFunc)thread_func, devc, NULL);
if (!my_thread) {
- sr_err("demo: %s: g_thread_create failed", __func__);
+ sr_err("demo: %s: g_thread_try_new failed", __func__);
return SR_ERR; /* TODO */
}