[Beignet] [PATCH] Fix the bug of forgetting add the program into the context list when new()

junyan.he at inbox.com junyan.he at inbox.com
Mon Aug 5 03:40:35 PDT 2013


From: Junyan He <junyan.he at linux.intel.com>

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 src/cl_program.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/cl_program.c b/src/cl_program.c
index 7870514..74ef6b2 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -100,6 +100,14 @@ cl_program_new(cl_context ctx)
   p->magic = CL_MAGIC_PROGRAM_HEADER;
   p->ctx = ctx;
 
+  /* Append the program in the list */
+  pthread_mutex_lock(&ctx->program_lock);
+  p->next = ctx->programs;
+  if (ctx->programs != NULL)
+    ctx->programs->prev = p;
+  ctx->programs = p;
+  pthread_mutex_unlock(&ctx->program_lock);
+
   /* The queue also belongs to its context */
   cl_context_add_ref(ctx);
 
-- 
1.7.9.5



More information about the Beignet mailing list