Hi All
I'm wondering how to thread my control class. I've got a main GUI class
that calls to the control class to perform all the work ( database,
processing, printing, ect... ).
What I'm looking to do is to thread that control class so that the GUI
dosen't "freeze" when a intensive process is called.
I've threaded in java before but am not quite sure how to go about it in C#.
I pretty much want my control class the run in its own thread the entire
time the program is running. Is this bad?
Thanks
Bryan 3 1139
You idea is a fine one. Code like:
Thread SolverThread = new Thread(new ThreadStart(Sol ver));
SolverThread.Pr iority = ThreadPriority. BelowNormal;
SolverThread.St art();
will do the trick. Read the description of classes Thread and ThreadStart.
If you want your solver thread to put data to the UI you will need to use
Invoke.
"Bryan Masephol" <ma******@uwec. edu> wrote in message
news:e0******** ******@TK2MSFTN GP10.phx.gbl... Hi All
I'm wondering how to thread my control class. I've got a main GUI class that calls to the control class to perform all the work ( database, processing, printing, ect... ).
What I'm looking to do is to thread that control class so that the GUI dosen't "freeze" when a intensive process is called.
I've threaded in java before but am not quite sure how to go about it in
C#. I pretty much want my control class the run in its own thread the entire time the program is running. Is this bad?
Thanks
Bryan
May also want to take a look at the ThreadPool class.
"Bryan Masephol" <ma******@uwec. edu> wrote in message
news:e0******** ******@TK2MSFTN GP10.phx.gbl... Hi All
I'm wondering how to thread my control class. I've got a main GUI class that calls to the control class to perform all the work ( database, processing, printing, ect... ).
What I'm looking to do is to thread that control class so that the GUI dosen't "freeze" when a intensive process is called.
I've threaded in java before but am not quite sure how to go about it in
C#. I pretty much want my control class the run in its own thread the entire time the program is running. Is this bad?
Thanks
Bryan
Steven wrote: May also want to take a look at the ThreadPool class.
Dot .NET is not like Java in that you have a JVM that works the same on all
on supported platforms. If you need to support Win98/WInME, not all methods
in the ThreadPool class are supported.
-Ed
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/29/2003 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tomaz Koritnik |
last post by:
I have a class that runs one of it's method in another thread. I use Thread
object to do this and inside ThreadMethod I have an infinite loop:
While (true)
{
// do something
Thread.Sleep(100);
}
The problem is that I don't know how to terminate the thread when my class
|
by: Daylor |
last post by:
hi.
i have multi thread application in vb.net
is there a way NET support, so i can mark the class , to be access
only for 1 thread each time ?
if there is , small sytax sample will help
//what i need to add , so only 1 thread per time can access this class in
MultiThread app.
|
by: Charles Law |
last post by:
My first thought was to call
WorkerThread.Suspend
but the help cautions against this (for good reason) because the caller has
no control over where the thread actually stops, and it might have a lock
pending, for example.
I want to be able to stop a thread temporarily, and then optionally resume
it or stop it for good.
|
by: MIke Brown |
last post by:
Hello all,
I've been searching for a solution on google for a problem related to
creating events from a worker thread, with no luck..
Basically, the problem is when my events are caught by a UI using my
class, they get the usual "Control 'blah' accessed from a thread other
than the thread it was created on.". I understand that of course, but
my class is to be distributed to people who don't want to have to worry
about invoking...
|
by: esakal |
last post by:
Hello,
I'm programming an application based on CAB infrastructure in the
client side (c# .net 2005)
Since my application must be sequencally, i wrote all the code in the
UI thread.
my problem occurs when i try to show a progress bar. The screen
freezes. I know i'm not the first one to ask about it. but i'm looking
| |
by: jayesah |
last post by:
Hi All,
I am writting a Thread class with using pthread library. I have some
problem in saving thread function type and argument type. How to make
Thread class generic ?
/* This is my global Function */
template < class FunType, class ArgType>
Thread makeThread(Funtype fun, ArgType arg)
|
by: Carl Heller |
last post by:
If I'm creating a class to do some work that I want threaded out, where's
the best location to call ThreadStart? Or does it depend on the nature of
the work?
a. Call it outside the class, giving it the starting method of the class?
b. Have the class create the thread itself?
ie:
x = new WorkerClass();
ioThread = new Thread(new ThreadStart(x.StartWork));
|
by: HolyShea |
last post by:
All,
Not sure if this is possible or not - I've created a class which
performs an asynchronous operation and provides notification when the
operation is complete. I'd like the notification to be performed on
the same thread thread that instantiated the class. One way to do this
is to pass an ISynchronizeInvoke into the class and use it to
synchronize the callback. In the constructor of the class, could I
take note of the current thread...
|
by: fniles |
last post by:
I create a thread where I pass thru a message. When I click very fast many
times (like 50 times) to create 50 threads, the message did not get pass
thru ProcessMessage.
For example: strBuffer = "#TRADE, D1410-123456, BUY, 1, ESM7, DAY, LIMIT,
1490.00, , , 0, 0, 0, 0, 0, links |52994/25/2007 10:47:17 AM !A", when I
trigger to create many threads (like 50), this message did not get to sub
ProcessMessage in clsEachMessage.
I have added...
|
by: Pubs |
last post by:
Hi all,
I want to call a function with some intial parameters with in a
thread. At the end of the function execution it should return a value
to the caller. Caller is outside the thread.
Example
function test (int a, int b);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |