Both pipe channels are currently configured as blocking. We read from the pipe
in receive_data. Since the channel is configured as blocking we'll block in
receive_data until all data has been received. receive_data will be called from
the mainloop, so as consequence the mainloop will be blocked until the demo
device has finished sampling. This is not so much of a problem if we are
sampling in blocking mode (using sr_session_run()) and the demo device is the
only device in the session, but it will fail badly for all other configurations
(e.g. multiple devices or async sampling).
Signed-off-by: Lars-Peter Clausen <redacted>
ctx->channels[0] = g_io_channel_unix_new(ctx->pipe_fds[0]);
ctx->channels[1] = g_io_channel_unix_new(ctx->pipe_fds[1]);
+ g_io_channel_set_flags(ctx->channels[0], G_IO_FLAG_NONBLOCK, NULL);
+
/* Set channel encoding to binary (default is UTF-8). */
g_io_channel_set_encoding(ctx->channels[0], NULL, NULL);
g_io_channel_set_encoding(ctx->channels[1], NULL, NULL);