473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Regaring threading - manualResetEvents

Hi all,

I have a problem regarding use of manualreset events in .net.
I have a developed a sample appliation in which entries from the
listview which I say is a queue for my processes.I want to schedule
these processes in my queue.
I also want to stop the processing by selcting the pause so that the
scheduling stops and again if i say add schedule the schedule should
start again.I have used manual reset events to control the
communication between scheduling. Bcz msdn says we can't have control
on autoreset events.
Remember I have used only one thread which is managing the entire
processing.

The sample code which i have tried is -

Class transferManager

Public Function New()
transferEvent(transferEvent.DATAAVAIL) = New
ManauaResetvent(false)
transferEvent(transferEvent.STOP) = New ManauaResetvent(false)
'pause the transfer
transferEvent(transferEvent.TERMINATE) = New
ManauaResetvent(false)
End Function

Public Function Start(Byval lvw as listview)
tranfermanager = lvw
transferThread.start()
End Function
Public Function Stop()
'check for wheter set event is data avail if yes then
transferEvent(transferEvent.DATAAVAIL).reset()
transferEvent(transferEvent.STOP).set()
'else
transferEvent(transferEvent.STOP).set()
End Function
Public Function DataAvailable()
'check for wheter set event is stop if yes then
transferEvent(transferEvent.STOP).reset()
transferEvent(transferEvent.DATAAVAIL).set()
'else
transferEvent(transferEvent.DATAAVAIL).set()
End Function
Public Function TransferEngine() 'thread proc associated with the
thread
Do while
'if any of the stop or terminate set then return
Do while tranfermanager.items.count <> 0
transfer( tranfermanager.items(0)) 'start process
end while
end while

End Function

Private transferEvent(2) as ManualResetEvent()
Private transferThread as new thread(false)
Private tranfermanager as new listview

End Class

SO my exact problem is i say "add schedule" the process is added and
call to DataAvailable() is given so that the scheduling is started .
But in between if i say stop the schudule is stoopped by calling
Stop(). Now if i again say add shedule call to DataAvailable()
doesn't start the thread again it is in 'stopped' state what could be
the reason. Any ideas.
That means somehow my Threadproc is not executing again after pause
Sample application would also do.

Thanks in advance

Dec 25 '05 #1
0 787

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
2
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
6
by: CK | last post by:
I have the following code in a windows service, when I start the windows service process1 and process2 work fine , but final process (3) doesnt get called. i stop and restart the windows service...
2
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True...
11
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
0
by: kingcrowbar.list | last post by:
Hello Everyone I have been playing a little with pyGTK and threading to come up with simple alert dialog which plays a sound in the background. The need for threading came when in the first...
2
by: snehal k | last post by:
Hi all, I need help regaring the foreign key concept in oracle. the scenario in my case is a table as temp_table has an attribute as 'temp_id' which is being reffered by more than 2 tables as...
7
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.