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 498255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:51:39+00:00 2026-05-13T05:51:39+00:00

Briefly, a manual reset event is a synchronization construct which is either in the

  • 0

Briefly, a manual reset event is a synchronization construct which is either in the “signaled” or “nonsignaled” state. In the signaled state, any thread which calls a wait function on the event will not block and execution will continue unaffected. Any and all threads which calls a wait function on a nonsignaled object will block until the event enters the signaled state.

The the transition between the signaled and nonsignaled states occurs only as a result of explicit calls to functions such as SetEvent and ResetEvent.

I’ve built a synchronization mechanism on Windows which uses both these manual reset events and their auto-reset siblings. The auto-reset mechanism can be easily replicated with a semaphore, but I’m struggling to find an equivalent for the manual-reset variety.

In particular, while a condition variable with “notify all” functionality might appear similar at first glance, it has considerably different (perhaps non-functional) behavior when you consider the fact that it requires an associated mutex. First, before the thread can wait on a condvar, it must get the associated mutex. In addition to the cost of getting and releasing the mutex, this serializes unnecessarily all the threads which are about to wait. On wake, even though all threads are notified, only one thread will actually get the mutex at a time, incurring additional performance and concurrency penalties, since the mutex serves no purpose in this case.

The release case is especially poor on a multi-CPU system given that the simultaneous release of all waiters guarantees that the difference between a condvar and a Windows event will be observable – with an Event, at N threads will become runnable on an N CPU system, and can run in parallel, while with a condvar – even with an implementation that avoids the thundering herd – the threads can only leak out one at a time through the associated mutex.

Any pointers to a construct that better imitates the behavior of manual reset events would be greatly appreciated. The closest I can find is a barrier – this allows the unsynchronized approach and release of multiple threads to the barrier – but the barrier “breaks” based on waiting thread count rather than an explicit application call, which is what I need.

  • 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-13T05:51:39+00:00Added an answer on May 13, 2026 at 5:51 am

    It’s Linux-only (I only mention it because you have a “linux” tag), but I think you could build something like this on the futex syscall. See Ulrich Drepper’s paper on Futexes for the gory details.

    Very roughly, I envisage something along the lines of

    void inline gate_wait(volatile int *gate)
    {
        if (*gate)
            while (futex(gate, FUTEX_WAIT, 1, 0, 0, 0) == EINTR)
                ;
    }
    
    int inline gate_open(volatile int *gate)
    {
        *gate = 0;
        return futex(gate, FUTEX_WAKE, INT_MAX, 0, 0, 0);
    }
    
    void inline gate_close(volatile int *gate)
    {
        *gate = 1;
    }
    

    If you do build this “gate” synchronisation primitive on top of futexes, it might be worth contributing it to Rusty Russell’s userspace futex library.

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

Sidebar

Ask A Question

Stats

  • Questions 247k
  • Answers 247k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Assuming you're asking how to convert a byte array to… May 13, 2026 at 8:42 am
  • Editorial Team
    Editorial Team added an answer First: Configure the session.cookie_lifetime directive, either in php.ini, configuration files,… May 13, 2026 at 8:42 am
  • Editorial Team
    Editorial Team added an answer You shouldn't override paint(). Use paintComponent() instead. Also, JFrames are… May 13, 2026 at 8:42 am

Related Questions

I'm confused about what the various testing appliances in Ruby on Rails are for.
Briefly: Does anyone know of a GUI for gdb that brings it on par
Briefly, I need to create a server whose back end queries information from another
Hi All, I'm designing a user control, briefly it contains an asp:hiddenfield control, i'm
I'll explain briefly what I want to accomplish from a functional perspective. I'm working

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.