sr_session_halt() in its current state is kind of useless and even dangerous. All it will do is mark the session as not running, but wont signal the devices to stop to capture data. This is not so much of a problem with the blocking sr_session_run(), but once there is support for asynchronous data acquisition by attaching the session sources to the applications mainloop sr_session_halt() basically becomes a no-op. sr_session_stop() already does what needs to be done, marking the session as not running and signal the devices to stop acquisition, so make sr_session_halt() an alias for sr_session_stop() and deprecate its usage.
Signed-off-by: Lars-Peter Clausen <[email protected]> --- libsigrok/session.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libsigrok/session.c b/libsigrok/session.c index 4ad2dff..a1bf6a7 100644 --- a/libsigrok/session.c +++ b/libsigrok/session.c @@ -328,22 +328,15 @@ SR_API int sr_session_run(void) /** * Halt the current session. * - * This requests the current session be stopped as soon as possible, for - * example on receiving an SR_DF_END packet. + * This function is deprecated and should not be used in new code, use + * sr_session_stop() instead. The behaviour of this function is identical to + * sr_session_stop(). * * @return SR_OK upon success, SR_ERR_BUG if no session exists. */ SR_API int sr_session_halt(void) { - if (!session) { - sr_err("session: %s: session was NULL", __func__); - return SR_ERR_BUG; - } - - sr_info("session: halting"); - session->running = FALSE; - - return SR_OK; + return sr_session_stop(); } /** -- 1.7.10 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ sigrok-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sigrok-devel

