?
Solved

VB threads

Posted on 2009-04-15
4
Medium Priority
?
209 Views
Last Modified: 2012-05-06
I have threads running and one of them needs to spawn a standalone process/thread that will do independent processing.  I need this to run in background.  I also need it to be spawned again while the first is still running.  I just barely know about threads.  In an attempt to do this I used the code below.  All of it is in the same class.

It is not reentrant.
Public pro_train As Thread
    Public Processing As New Process_Train
 
   pro_train = New Thread(AddressOf Me.ProcessTheTrain)
   pro_train.Priority = ThreadPriority.Lowest
   pro_train.Start()
 
    Sub ProcessTheTrain()
            Processing.CCLPS_Main(OutputFileName)
 
    End Sub

Open in new window

0
Comment
Question by:fsoucy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:obrienslalom
ID: 24150394
The code looks like you have the right idea.  What problems are you having?
This link is certainly worth a read:
http://www.albahari.com/threading/
If you plan on writing lots of concurrent programs, you may want to pick up Joe Duffy's "Concurrent programming on Windows" book.
Also, you probably want to add this to the VB zone.
0
 

Author Comment

by:fsoucy
ID: 24158421
The standalone thread is not relinquishing the CPU enough to allow other threads to operate in near real time.  The real time threads are set to a priority of High.

I tried to remidy this by adding DoEvents in places where there was loops with a large amount of iteration.  All that did was slow the background process.
0
 
LVL 6

Accepted Solution

by:
obrienslalom earned 1500 total points
ID: 24164130
The 'real time' threads you are referring to are for the GUI?

When you spawn off the new thread, it will not discriminate between the two threads.  If you are seeing the application hang, something else might be going on.  Try not to use DoEvents until you know the messages are stuck in the message queue.
0
 

Author Comment

by:fsoucy
ID: 24167588
The real time threads are for data capture through high speed serial ports.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question