Catch2: Support thread safety throughout the API

Created on 10 Oct 2017  路  10Comments  路  Source: catchorg/Catch2

I am using INFO, for example, to help record where tests are during execution. This is during a multi-threaded situation: server running in a separate thread. Clients connecting on the parent thread. When I sprinkle INFO throughout client and server code, the program crashes hard.

Most helpful comment

I would love to see this addressed in Catch2.

All 10 comments

Just ran into the same issue today as well but with REQUIRE, having support for thread safety in the assertion & logging macros would be really nice. For us it wouldn't have to be for all tests but some of our tests are specifically there to verify multithreaded code

@repi I'm sure it's for REQUIRE as well. I just called out INFO as a first observation. Point is, thread-safety is A MUST.

This need is one of the key drivers for Catch2 rebasing on C++11.
Once Catch2 is fully released this will be one of the first major tasks - it's been on the wish-list for a looong time.

@philsquared I'd say with the advent of std::thread, there really is no excuse for it to be a wish. In other words, that's not strong enough of a word, IMO.

Exactly! Before Catch2, and thus C++11, we didn't _have_ std::thread

Sweet, we are all in agreement 馃憤

@repi @philsquared Yes, I think we agree on the what. Now is a question of the when, which may necessarily be predicated on the who.

How is that looking? Just ran into this issue, too.

I would love to see this addressed in Catch2.

No idea; I've moved on to other non-C++ areas at the moment, so this is not on my radar screen apart from peripheral view.

Was this page helpful?
0 / 5 - 0 ratings