Skip to content

Commit ba8ba05

Browse files
mhalkronlieb
authored andcommitted
[OpenMP][OMPT] Fix accidental concatenation of notifications
Fix the rather common occurrence of concatenated notifications. Especially the asynchronously generated trace records could potentially 'interleave' just between putting the notification and the newline char. Change-Id: I34ddc10660788018d31b4dc9b4f02f677c44cbf3
1 parent 1b459c6 commit ba8ba05

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

openmp/libomptarget/test/ompTest/src/OmptAsserter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,5 +268,8 @@ void OmptEventReporter::notify(OmptAssertEvent &&AE) {
268268
if (!isActive() || isSuppressedEventType(AE.getEventType()))
269269
return;
270270

271-
OutStream << AE.toString() << std::endl;
271+
// Prepare notification, containing the newline to avoid stream interleaving.
272+
auto Notification{AE.toString()};
273+
Notification.push_back('\n');
274+
OutStream << Notification;
272275
}

0 commit comments

Comments
 (0)