Commit 54e82330 authored by Xavier Teruel's avatar Xavier Teruel

The service omp_get_thread_num() now returns -1 if thread is not part of the...

The service omp_get_thread_num() now returns -1 if thread is not part of the runtime yet; this query allows to determine either we need to call and admit_current_thread service or not; closes #1247
parent a5889a0c
......@@ -62,7 +62,11 @@ extern "C"
NANOS_API_DEF(int, omp_get_thread_num, ( void ))
{
//! \todo check if master always gets a 0 -> ensure condition ?
return myThread->getTeamData()->getId();
if (myThread && myThread->getTeamData()) {
return myThread->getTeamData()->getId();
} else {
return -1;
}
}
int nanos_omp_get_thread_num ( void ) __attribute__ ((alias ("omp_get_thread_num")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment