stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: string methods thread safety
Date Fri, 07 Jul 2006 00:45:43 GMT
Martin Sebor wrote:
> I have a semi-exhaustive thread safety test for sting stashed
> away somewhere. Let me dig it up and post it to give you an
> idea.

The test is attached. It's supposed to be portable across most
today's C++ implementations (which isn't our goal).

The thread safety tests I envision for our test suite would
exercise a subset (as small as a pair) of functions per each
run. The one constant (as in the same across all test runs)
function would be the copy ctor (or its equivalent such as
the assignment operator) and the other a modifying string
function. The copy ctor would be used to create a copy of
a shared string object for each thread and the modifying
function would then operate on the copy.

The test would serve as its own driver with the initial
invocation spawning a new process (a copy of self) for each
subset (or pair) of tested functions and reporting non-zero
exit status of the child process as an assertion failure.
That way the test would exhaustively exercise all subsets
of the tested functions even if one or more of them crashed
(which is the typical manifestation of thread-safety bugs)
and clearly report which one failed (which would be hard
to do otherwise).

This last part would be best implemented in the test driver
under some generic interface similar to rw_thread_create()
(e.g., rw_process_create()).

If this doesn't sound like something you'd like to tackle feel
free to move on to other types of string tests, or if we're
done with those, to the container tests.


View raw message