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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:52:19+00:00 2026-06-15T07:52:19+00:00

Based upon this question i decided to try to use waithandles/eventwaithandle for my solution

  • 0

Based upon this question i decided to try to use waithandles/eventwaithandle for my solution based upon Jim Mischel recommendation. I “almost” have it working. Here is the code

Private Sub InitDeploymentCheck()
moDeploymentCheck = New TRS.Deployment.TRSDeploymentCheck(EnvironmentVariables.Environment, AppDomain.CurrentDomain.BaseDirectory.Contains("bin"), MDIMain)
AddHandler moDeploymentCheck.DeploymentNeeded,
    Sub()
        moTimer = New System.Windows.Forms.Timer()
        moTimer.Interval = 300000 '5 minutes
        moTimer.Enabled = True
        AddHandler moTimer.Tick,
            Sub()
                'check to see if the message box exist or not before throwing up a new one

                'check to see if the wait handle is non signaled, which means you shouldn't display the message box
                If waitHandle.WaitOne(0) Then
                    'set handle to nonsignaled
                    waitHandle.Reset()
                    MessageBox.Show(MDIMain, "There is a recent critical deployment, please re-deploy STAR to get latest changes.", "Critical Deployment", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                    'set the handle to signaled
                    waitHandle.Set()
                End If


            End Sub
        waitHandle.Set()
        MessageBox.Show(MDIMain, "There is a recent critical deployment, please re-deploy STAR to get latest changes.", "Critical Deployment", MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End Sub
End Sub

Again this is from a base form that pretty much all our applications inherit from. When we are using a single app it works perfectly. If your running multiple apps that inherit from the base form and someone clicks just one of the message boxes sometimes a second message box will display in another app. I originally had waithandle declared as static/shared and thought that was the problem but it wasn’t. I also tried to have each app create its own waithandle and pass it into the base and it resulted in the same affect. Does anyone have an idea why it appears the waithandle is being shared between different applications? Oh by the way, waitHandle is actually a ManualResetEvent

  • 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-15T07:52:21+00:00Added an answer on June 15, 2026 at 7:52 am

    First, if you want to use this across multiple applications, you’ll have to create a named EventWaitHandle using this constructor, or one of the others that creates a named object. A ManualResetEvent will only work for a single process.

    Second, a named Mutex is probably a better solution. I just realized that the code I recommended has a race condition. If Thread A does the WaitOne(0) and it succeeds, and then Thread B comes along and does the same thing before Thread A can call Reset, then both threads will end up displaying the message box.

    Using a Mutex and WaitOne(0) will solve that problem. Be sure to release the Mutex, though:

    if (mutex.WaitOne(0))
    {
        try
        {
            // do stuff
        }
        finally
        {
            mutex.ReleaseMutex();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Based on this question Fade in/out text based upon value of counter I have
Based upon this question How to declarate LARGE_INTEGER in C# with answer of: [StructLayout(LayoutKind.Absolute,
Please see my answer to this question below. It is based upon Kevin's input,
This scenario is based upon a schema in another question and I'm not interested
I am writing wordpress plugin. This plugin will create widgets based upon response of
I have a Tabular type Form based upon a SELECT * FROM table type
I have a need to sort a collection of these based upon criteria determined
I have some code in method C that will get executed based upon the
I have an enum. Based upon the value brought by model, I have to
Question Is there a way to split up each class based upon a prefix

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.