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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:48:17+00:00 2026-05-23T11:48:17+00:00

I have an issue with my current .net application and is the follow, when

  • 0

I have an issue with my current .net application and is the follow, when a database row is updated or a new row is inserted, my .net service has to read those changes and submit an print order.

I’d implemented the follow functions :

public void OnStart()
{
   ThreadMgmt pthread = new ThreadMgmt();
   pthread.printNotification += new pthread.DatabaseChanged();
   pthread.frequency = 2000;

   ThreadStart ts = new ThreadStart(pthread.Wait);
   Thread t = new Thread(ts);

   t.Start();
}

void ReadDataBase() {...}

void Printing(){...}

public class ThreadMgmt 
{
  public delegate void UpdateDelegate();

  public event UpdateDelegate Notify;

  private int frequency {set;get;}


     public void Wait()
     {
        for (int i = 0; i <= Freq; i++)
        {
           Thread.Sleep(this.frequncy);
           Notify();
        }
     }
}

But I need some help about concepts about threading and looping events, I would like to know if anybody has to face the same problem and how to resolve it…

Thanks

  • 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-23T11:48:18+00:00Added an answer on May 23, 2026 at 11:48 am

    Here’s a simple solution.

         private bool m_stop;
         public void Stop ()
         {
            lock (this)
               m_stop = true;
         }
    
         public void Wait()
         {
            for (int i = 0; i <= Freq; i++)
            {
               lock (this)
               {
                  if (m_stop)
                     return;
               }
               Thread.Sleep(this.frequncy);
               if (Notify != null)
                  Notify();
            }
         }
    

    If you want shutdown to occur quicker, you can use Monitor.Wait and Monitor.PulseAll, but you should read up on these before you decide to do it.

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

Sidebar

Related Questions

The current situation is as follows: We have an production .net 3.5 WCF service,
We have an old asp.net application that has no unit tests, integration tests, component
I have an issue using c# on .Net 4 in a MVC web application,
I have a Windows Forms application developed using C# in .NET framework 3.5, Service
I have a strange issue: I am using SPContext.Current.Web in a .aspx page, but
We have an issue related to a Java application running under a (rather old)
I have this issue: I have WebSite with asp.net pages. http://desiis:90/WebSite1 In this webSite,
So I have an asp.net Web Application (Not Web Site) that I am trying
I have a ASP.NET Web Forms application that internally makes many SOAP and REST
My clients are trying to revive an ASP.NET 1.0 application (yes, you read that

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.