473,322 Members | 1,421 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,322 software developers and data experts.

Threading priority (maybe?)

I have a form that contains the attached code that starts a new thread.
Thewre are three routines. StartMomnitoring starts the thread DoMonitor, and
StopMonitor stops the thread. The "SendRec" routine sends amessage out a
Tcp/Ip socket and returns the returned value. As the DoMonitor thread shows,
there is a sleep of 1 msec so I would expect a rate depending on the
internet latency. Here is the problem..

When started, I get an exchange rate of about 2 per second. However, if I
right click on the title barof the form, I get a pop up window with move,
close, etc options, and the rate increases to about 30 per second. I have
thought about trhread priority but changing the priority makes no difference.

Any thoughts anybody??
Public Sub StartMonitoring()
Dim t1 As New Thread(AddressOf DoMonitor)
Console.WriteLine("starting thread")
't1.Priority = ThreadPriority.Highest
t1.Start()
End Sub

Public Sub StopMonitoring()
Console.WriteLine("stopping thread")
RunStop = 0
End Sub

Sub DoMonitor()
Dim s As String
Dim ss As String
Dim p() As String
Dim pp As String
Dim I As Int32 = 0
Dim xx As Integer
RunStop = 1
Dim OFile As New StreamWriter(Application.StartupPath &
"\Data\LogFile.txt")
Do
If I = Count Then I = 0
s = Ant0.WriteRead(Cmd(I))
ss = Now.ToString("hh:mm:ss") & "," & s
Console.WriteLine(ss)
OFile.WriteLine(ss)
MonBox.Text = ss
'Thread.Sleep(10)
If RunStop = 0 Then Exit Do
I += 1
Loop
OFile.Close()
End Sub
Nov 21 '05 #1
0 877

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

Similar topics

19
by: Jane Austine | last post by:
As far as I know python's threading module models after Java's. However, I can't find something equivalent to Java's interrupt and isInterrupted methods, along with InterruptedException....
4
by: Joe Wong | last post by:
Hi, Is there any way to increase/decrease a thread priority in Python? Best regards, -- Wong
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...
4
by: Bardo | last post by:
Hi, I have a situation where I am capturing both a WMI event utilising the "ManagementEventWatcher" in the "System.Management" namespace, and a corresponding event ("EntryWritten") raised from...
3
by: Brian Keating EI9FXB | last post by:
Hello again, I've already placed a few posts on this topic. This time i've a simple application that exhibits my problem, I've placed sample solution 8k on my website should anyone be interested...
1
by: craigedmunds | last post by:
Was having a few problems with some threading issues following the microsoft support webcast Microsoft ASP.NET Threading. Spoke to Wade Mascia & managed to get clarification. Thought i'd share it...
0
by: hamil | last post by:
I have a form that contains the attached code that starts a new thread. Thewre are three routines. StartMomnitoring starts the thread DoMonitor, and StopMonitor stops the thread. The "SendRec"...
9
by: AdrianJMartin | last post by:
Hi all, I have a need for a STA thread from asp.net. I can create the thread and it runs fine. But when it is finished, the thread still 'hangs' arround. Visible only to the debugger..... I get...
8
by: Luc | last post by:
Hi, I am writing software to automate some testing. I have one main form to set up the tests, and once this is complete, I open 4 identical forms to monitor each different device that I am...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.