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

  • Home
  • SEARCH
  • 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 6003993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:11:59+00:00 2026-05-23T01:11:59+00:00

For example, every time an asynchronous operation completes which has been affecting the state

  • 0

For example, every time an asynchronous operation completes which has been affecting the state of the application I do this

lock (_parent._stateObj) {

    _parent._asyncOperations.Remove(this);

    Monitor.PulseAll(_parent._stateObj);

}

I do this so that anything waiting for operations complete, like a logout routine, will be notified.

Do I/Should I be doing something more along the lines of

lock (_parent._stateObj) {

    _parent._asyncOperations.Remove(this);

    if (_parent._loggingOut) Monitor.PulseAll(_parent._stateObj);

}

Just trying to figure out if I should always be Pulsing when the internal state of the application changes. And in a large library with mostly async calls, is it true that I should more or less always use PulseAll since there can be any number of async calls taking place which have “registered” themselves in the main state of the library?

Hope this makes sense

  • 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-23T01:12:00+00:00Added an answer on May 23, 2026 at 1:12 am

    Yes, it is typically acceptable, and sometimes even mandatory, to PulseAll unconditionally. The most important thing to remember is to always recheck the wait condition when calling Wait.

    public void WaitingThread()
    {
      lock (mylock)
      {
        while (!CanProceed())
        {
          Monitor.Wait(mylock);
        }
        // The wait condition is finally satisfied so we can proceed now.
      }
    }
    

    So if you have the blocking side of the PulseAll\Wait scheme coded correctly then it usually will not matter how the pulses are generated. Without having a better understanding of your particular situation I cannot say for sure which pulsing strategy is optimal, but I think I can at least say that pulsing unconditionally will not cause any unintended side-effects (again, assuming that the waiting side is coded correctly).

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

Sidebar

Related Questions

It seems I can't make this example print "You submitted nothing!". Every time I
I got this example from a blog, but every time I do this: $(':input[name='
For example, if I want to comment this: (defun noop () nil) Every time
For invoke search android example, every time query search result is received by onCreate().
In the following example should I expect that values.size() will be called every time
If I want to select every image which it's alt is Home for example,
Example, for web applications using Turbogears and SQLAlchemy. Every time I update my data
For example, i have a column named EmployeeName. Every time a user changes/fix his
I use crontab to invoke rake task at some time for example: every 3
I am trying with program code from http://liboauth.sourceforge.net/tests_2oauthexample_8c-example.html but every time I am getting

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.