소스 검색

Make sure to wait for the thread which woke us and let us destroy the job

Samuel Thibault 13 년 전
부모
커밋
7e7a40d54e
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/core/jobs.c

+ 4 - 0
src/core/jobs.c

@@ -106,6 +106,10 @@ struct _starpu_job* __attribute__((malloc)) _starpu_job_create(struct starpu_tas
 
 void _starpu_job_destroy(struct _starpu_job *j)
 {
+	/* Wait for any code that was still working on the job (and was
+	 * probably our waker) */
+	_STARPU_PTHREAD_MUTEX_LOCK(&j->sync_mutex);
+	_STARPU_PTHREAD_MUTEX_UNLOCK(&j->sync_mutex);
 	_STARPU_PTHREAD_COND_DESTROY(&j->sync_cond);
 	_STARPU_PTHREAD_MUTEX_DESTROY(&j->sync_mutex);