Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 556587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:56:08+00:00 2026-05-13T11:56:08+00:00

My weekend project consists of writing a cross-platform concurrency primitives library (critical sections, read/write

  • 0

My weekend project consists of writing a cross-platform concurrency primitives library (critical sections, read/write mutexes, interlocked integers, events, etc) and was wondering how to unit test this stuff. I realize that testing concurrent code is hard in itself, but testing the primitives of said code couldn’t be that hard, could it?

Turns out, it is that hard. At least, for me it is.

So how would you go about approaching this? Just as an example, I don’t even know where to start with testing critical sections.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:56:08+00:00Added an answer on May 13, 2026 at 11:56 am

    Don’t think about unit tests, think about the behaviour you want to specify. For example:

    Given_an_unlocked_lock
        It_should_be_possible_to_take_it
    Given_a_locked_lock
        It_should_not_be_possible_to_take_it_from_another_thread
        It_should_be_possible_take_it_from_the_same_thread
    Given_a_locked_lock_when_unlocked
        It_should_be_possible_to_take_it
    Given_a_locked_lock_when_owning_thread_terminates
        It_should_be_possible_to_take_it
    

    I think that will help you identify what to do. And yes probably you need a helper thread in your unit tests to make it happen. Maybe this example is helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This weekend I was working on a project and I needed to use a
I was plugging away on an open source project this past weekend when I
I am getting my senior project gallery-ready for a show this weekend. It is
Over the weekend, another programmer added a file to a project and committed it
For a weekend project I'm looking for a micro web-framework like bottle.py (http://bottlepy.org) but
I'm making a js-based epub reader as a weekend project and I'm trying to
This is just for my weekend project/study, I am very new to Sinatra and
I'm in the process of building a little project this weekend called Pirates Vs.
I have spent the weekend working on a personal project and got stuck here.
OK, so I am using a jQuery plugin called CountUp: http://blog.ogulcanorhan.com/weekend-project-jquery-countup-plugin/ The script is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.