Skip to content

Commit f4f93e6

Browse files
committed
Fix file simple test for non threaded tests
The simple file test deadlocked when run without mpi2-threads being enabled. This was caused by calling and checking for a thread with number 0. Instead one should check for TST_THREAD_MASTER - and do not use thread related code in non-threaded runs, i.e., put ifdefs around. Signed-off-by: Christoph Niethammer <[email protected]>
1 parent 12230b3 commit f4f93e6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

io/tst_file_simple.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ int tst_file_simple_init (struct tst_env * env)
3838
memset (file_name, 0, sizeof (char)*100);
3939
sprintf(file_name, "%s%ld", TST_FILE_NAME, (long)getpid());
4040
}
41-
if (0 == tst_thread_get_num())
41+
#ifdef HAVE_MPI2_THREADS
42+
if (tst_thread_get_num() == TST_THREAD_MASTER) {
43+
#endif
4244
MPI_CHECK (MPI_Bcast(file_name, 100, MPI_CHAR, ROOT, comm));
45+
#ifdef HAVE_MPI2_THREADS
46+
}
47+
#endif
4348
env->read_buffer = tst_type_allocvalues (env->type, env->values_num);
4449
tst_file_alloc(env->type, env->values_num, comm_size, file_name, comm);
4550

0 commit comments

Comments
 (0)