google / google/googletest

Support multithreading on non-POSIX platforms

Open
#2,380 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
39.6k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

I've got an idea to leverage the fact that we use C++11.

In primer.md there is a [known limitation](https://github.com/google/googletest/blob/master/googletest/docs/primer.md#known-limitations) that has been around since 642acb (more than 4 years old) and it suggests to write custom platform-specific implementations for concurrency support.
Quote:
> Google Test is designed to be thread-safe. The implementation is thread-safe on systems where the pthreads library is available. It is currently unsafe to use Google Test assertions from two threads concurrently on other systems (e.g. Windows). In most tests this is not an issue as usually the assertions are done in the main thread. If you want to help, you can volunteer to implement the necessary synchronization primitives in gtest-port.h for your platform.

Now, after we've finally switched to C++11, I suppose it's high time to do it right and have one, portable implementation which will work everywhere. I've started working on a new pull request that will deal with it, though it's not that easy and it's presumably going to take some longer time.

@gennadiycivil - please let me know if you have insight against it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the known limitation in primer.md and inspect the synchronization primitives in gtest-port.h. Determine how the current pthread-based and non-POSIX paths behave under concurrent assertions. Done means Google Test has portable C++11 concurrency support and is safe for concurrent assertions on non-POSIX platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.