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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:17:04+00:00 2026-06-12T22:17:04+00:00

I am working in C++ in VS2010, and I have a container class with

  • 0

I am working in C++ in VS2010, and I have a container class with a bunch properties (getters and setters) (actually a bunch of objects with properties – but lets simplify it and assume that it is just a properties directly on the container class.

On this container class there is an Update function, and its important that the setters methods are blocked while the Update method is executing.

The app is multithreaded, so I was thinking to use mutex/events/critical section to handle this.

My question is: how can I lock/block the setters while the Update method is in action, without letting the setter methods block each other? Further, I will also need the setters to block the Update method.

In other words, I need a normal Critical Section mechanism, with the exception that the setters should not block each other.

Thanks in advance,
Martin

  • 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-06-12T22:17:05+00:00Added an answer on June 12, 2026 at 10:17 pm

    If there is no requirement for the setters (ex: setPropertyX(value)) to be concurrently protected, this is doable with a single semaphore and a manually resettable event, where the initial resource count is the number of properties you’re guarding against.

    in any given setter:

    • Wait on NoUpdatePendingEvent as set.
    • Acquire semaphore resource (1)
    • Update property value
    • Release semaphore resource (1)

    in the main update routine

    • NoUpdatePending event clear
    • Acquire semaphore resources (n)
    • Do update
    • Release semaphore resources (n)
    • NoUpdatePending event set

    where (n) is the number of properties you have. The initial state of NoUpdatePending is set, and waiting on it will NOT reset it (thus the manual-reset-only requirement). You cannot enter the update so long as any property is being updated. as soon as you enter the Update code and clear the NoUpdatePending event, incoming prop-updates will stall on the event and not consume semaphore resources. All running prop-sets will eventually release the resources needed for the update to continue.

    All of that said, still consider property concurrency individually.

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

Sidebar

Related Questions

I am working on a website in VS2010 and I have a datatable that
I am working on a webpage in C# on VS2010. I have a gridview
I have been working with crystal reports for some time but the current problem
I have a C# Web app that runs perfectly fine in VS2010, but when
I am working in vs2010. I have created a DataGrid which is bounded to
I have VS2010 and I'm working on a windows form application. So, I have
I have a PivotViewer app I am working on, but, I cannot get it
I have done this for other apps but for some reason its not working
I am working on project (VS2010 .NET) and have two SQL Server databases, Dev
I have a simple mapping and it is working but it's not filling in

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.