Rodrigo Arias
0439399f05
Until now, the value returned by ovni_thread_isready() was still non-zero when the thread stream was destroyed in ovni_thread_free() This was making it impossible to detect when a stream was destroyed. This change makes it return 0 after ovni_thread_free() by using a new finished flag. The flag keeps track on then the stream is destroyed, preventing double initialization of a free stream.
28 lines
570 B
C
28 lines
570 B
C
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
|
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
|
|
|
#include <ovni.h>
|
|
#include "instr.h"
|
|
|
|
/* Check the behavior of ovni_thread_isready(), which should only be 1
|
|
* after ovni_thread_init() and before ovni_thread_free(). */
|
|
|
|
int
|
|
main(void)
|
|
{
|
|
if (ovni_thread_isready())
|
|
die("thread must not be ready before init");
|
|
|
|
instr_start(0, 1);
|
|
|
|
if (!ovni_thread_isready())
|
|
die("thread must be ready after init");
|
|
|
|
instr_end();
|
|
|
|
if (ovni_thread_isready())
|
|
die("thread must not be ready after free");
|
|
|
|
return 0;
|
|
}
|