Hi All,
I need to develop an application which should use multithreading concept. I need run the multiple threads. And I need to have the one monitoring thread which should monitor all these threads, and make these threads sleep/kill if there is nothing to process in the perticualr thread. And it also create the new threads if any thing comes new to process. This application should run in 24/7 time. So need to make sleep/kill unused threads.
This all need to work in background as a servic. This sholud be developed using C#. Please let me know which type of application full fills my requirement. And also help me in creating the monitoring thread here.
This is required to send an SMS to the mobile so that no message should be loss. while implementing this threading.
Thanks in advance
Loading

Jean PaulRank #32 · 38.5K reputationPosted Dec 1, 2010, 6:20 AM EST
Solution: In the windows service OnStart event, you can create a thread which will execute a custom class ThreadManager.Start() method.
This method will be having an infinite while loop. The Start() method will determine other threads to be created.
Inside the while loop the thread can look for new job entries through a globally available static list.
CrishRank #1,487 · 1.1K reputationPosted Dec 6, 2010, 12:13 AM EST
You can refer following code.It will help you.
Imports System.Threading ... ' This value is incremented by all threads. Public Value As Integer = 0 Private Sub btnStartThread_Click(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _ btnStartThread.Click ' Make a new counter object. Static thread_num As Integer = 0 Dim new_counter As New Counter(Me, thread_num) thread_num += 1 ' Make a thread to run the object's Run method. Dim counter_thread As New Thread(AddressOf _ new_counter.Run) ' Make this a background thread so it automatically ' aborts when the main program stops. counter_thread.IsBackground = True ' Start the thread. counter_thread.Start() End SubSam HobbsRank #107 · 20.5K reputationPosted Dec 6, 2010, 2:38 PM EST