]> sigrok.org Git - libsigrok.git/blobdiff - src/session.c
Store a context pointer in struct sr_session.
[libsigrok.git] / src / session.c
index 765a20c451471b1266be4103544ad77f0979c1d1..276c5d17a997dc8cc93b2321b71c4259373043ab 100644 (file)
@@ -62,6 +62,7 @@ struct datafeed_callback {
 /**
  * Create a new session.
  *
+ * @param ctx         The context in which to create the new session.
  * @param new_session This will contain a pointer to the newly created
  *                    session if the return value is SR_OK, otherwise the value
  *                    is undefined and should not be used. Must not be NULL.
@@ -71,7 +72,8 @@ struct datafeed_callback {
  *
  * @since 0.4.0
  */
-SR_API int sr_session_new(struct sr_session **new_session)
+SR_API int sr_session_new(struct sr_context *ctx,
+               struct sr_session **new_session)
 {
        struct sr_session *session;
 
@@ -80,6 +82,7 @@ SR_API int sr_session_new(struct sr_session **new_session)
 
        session = g_malloc0(sizeof(struct sr_session));
 
+       session->ctx = ctx;
        session->source_timeout = -1;
        session->running = FALSE;
        session->abort_session = FALSE;