Hey all.
I need a improved code that waits for a execution before an another
precedure terminate processing.
Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop
While Not ThatFunctionTerminated
System.Windows.Forms.Application.DoEvents()
Syste.Threading.Thread.Sleep(1)
End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no
UI locking?
That loop runs in a server application, so that can be called many times at
same time. And the administrator need to be able to open the server
application and work with it, with no UI locking.
Cesar 13 1154
Cesar,
1 milliseconds is not so much
:-))
Cor
"Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht
news:ek**************@TK2MSFTNGP10.phx.gbl... Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
Well, I guess that code was taking too many CPU execution. By your answer,
that code is already the correct practice?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl... Cesar,
1 milliseconds is not so much
:-))
Cor
"Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht news:ek**************@TK2MSFTNGP10.phx.gbl... Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
Cesar,
I think so however I would try it with something as 50 milliseconds minium
Cor Well, I guess that code was taking too many CPU execution. By your answer, that code is already the correct practice?
> that code is already the correct practice?
i think that the answer depends on the rest of your code
i would prefer an event driven aproach , if you are bussy with threading
regards
Michel Posseth [MCP]
"Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht
news:O6*************@TK2MSFTNGP10.phx.gbl... Well, I guess that code was taking too many CPU execution. By your answer, that code is already the correct practice?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:%2***************@TK2MSFTNGP15.phx.gbl... Cesar,
1 milliseconds is not so much
:-))
Cor
"Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht news:ek**************@TK2MSFTNGP10.phx.gbl... Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
I know this might not be very helpful right here and now,
but if you want to learn about multithreading in VB.NET,
go buy a copy of "Moving to VB.Net, 2nd Ed" by
Dan Appleman: http://tinyurl.com/9js8t
Chapter 7 (around 50-60 pages) is dedicated to multithreading.
Sure, you can find the same information online, but
this chapter goes to great lengths explaining the pitfalls
of using multithreading in VB.Net.
I am certainly going to re-read (and re-read) it if I
start using it.
Regards,
Joergen Bech
On Tue, 27 Dec 2005 12:43:28 -0300, "Cesar Ronchese"
<info||carsoftnet.com.br> wrote: Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
Hi,
Your code is similar to what I do.
However... If you are seeing the Task Manager go to 100% (which IS NOT a
hang -- other applications still get their full portion of processing time),
there is something else going on. The Sleep should keep your app from going
to 100%, so perhaps there is some other code in your app that is consuming
the time?
Dick
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See www.mabry.com/vbpgser4 to order.
If you can get a handle to the application you're waiting on, you can have
the OS block your thread until that handle signals using the
WaitForSingleObject API. You'll need to do this is in a worker thread as
all Wait Functions block their thread.
Mike Ober.
"Cesar Ronchese" <info||carsoftnet.com.br> wrote in message
news:ek**************@TK2MSFTNGP10.phx.gbl... Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with
no UI locking?
That loop runs in a server application, so that can be called many times
at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
Unfortunatelly, I cant use event... the server program controls when the
task was executed and dispatch it to client, which is already waiting the
for response.
"m.posseth" <po*****@planet.nl> wrote in message
news:eI**************@TK2MSFTNGP09.phx.gbl... that code is already the correct practice?
i think that the answer depends on the rest of your code
i would prefer an event driven aproach , if you are bussy with threading
regards
Michel Posseth [MCP] "Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht news:O6*************@TK2MSFTNGP10.phx.gbl... Well, I guess that code was taking too many CPU execution. By your answer, that code is already the correct practice?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:%2***************@TK2MSFTNGP15.phx.gbl... Cesar,
1 milliseconds is not so much
:-))
Cor
"Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht news:ek**************@TK2MSFTNGP10.phx.gbl... Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
I can change it, sure. I was thinking really there was another improved form
to do that :-D
Thanks
Cesar
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:O5**************@TK2MSFTNGP11.phx.gbl... Cesar,
I think so however I would try it with something as 50 milliseconds minium
Cor Well, I guess that code was taking too many CPU execution. By your answer, that code is already the correct practice?
Not going to 100%, thanks to the Sleep() method, as you said too. What I
meant about taking CPU processing (did not noticed it was important, anyways
is my fail to explain) is because I did some tests breaking package, and the
time to terminate the job is a horror comparing direct execution. As I said,
I would like to know if there are other form to do that.
As you guys do this way also, so I'll keep it.
Thanks
Cesar
"Dick Grier" <di**************@msn.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl... Hi,
Your code is similar to what I do.
However... If you are seeing the Task Manager go to 100% (which IS NOT a hang -- other applications still get their full portion of processing time), there is something else going on. The Sleep should keep your app from going to 100%, so perhaps there is some other code in your app that is consuming the time?
Dick
-- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See www.mabry.com/vbpgser4 to order.
Actually you can - use the EnumWindows API to find your process. If it's
not running, the EnumWindows API won't find it. If it is, you'll get either
the hWND or the Handle to the process. Once you have that, you can wait for
it.
Mike Ober.
"Cesar Ronchese" <info||carsoftnet.com.br> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl... Unfortunatelly, I cant use event... the server program controls when the task was executed and dispatch it to client, which is already waiting the for response.
"m.posseth" <po*****@planet.nl> wrote in message news:eI**************@TK2MSFTNGP09.phx.gbl... that code is already the correct practice?
i think that the answer depends on the rest of your code
i would prefer an event driven aproach , if you are bussy with threading
regards
Michel Posseth [MCP] "Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht news:O6*************@TK2MSFTNGP10.phx.gbl... Well, I guess that code was taking too many CPU execution. By your answer, that code is already the correct practice?
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:%2***************@TK2MSFTNGP15.phx.gbl... Cesar,
1 milliseconds is not so much
:-))
Cor
"Cesar Ronchese" <info||carsoftnet.com.br> schreef in bericht news:ek**************@TK2MSFTNGP10.phx.gbl... > Hey all. > > I need a improved code that waits for a execution before an another > precedure terminate processing. > Nowadays, I use the following code: > > > (...) 'executing some new threaded function... > > 'loop > While Not ThatFunctionTerminated > System.Windows.Forms.Application.DoEvents() > Syste.Threading.Thread.Sleep(1) > End While > > (...) 'code to response to user... > > > But this code devoures some CPU processing. > > There are some inbuilt method that waits for a procedure execution, > with no UI locking? > > That loop runs in a server application, so that can be called many > times at same time. And the administrator need to be able to open the > server application and work with it, with no UI locking. > > > Cesar > > > >
Hmmm.. really, I already have that book (were my first .Net book I bought).
Although that's applicable to .Net 2002, it still can be useful. I'll read
that chapter again. :)
Thanks for the reminder
"Joergen Bech @ post1.tele.dk>" <jbech<NOSPAMNOSPAM> wrote in message
news:cj********************************@4ax.com... I know this might not be very helpful right here and now, but if you want to learn about multithreading in VB.NET, go buy a copy of "Moving to VB.Net, 2nd Ed" by Dan Appleman: http://tinyurl.com/9js8t
Chapter 7 (around 50-60 pages) is dedicated to multithreading.
Sure, you can find the same information online, but this chapter goes to great lengths explaining the pitfalls of using multithreading in VB.Net.
I am certainly going to re-read (and re-read) it if I start using it.
Regards,
Joergen Bech On Tue, 27 Dec 2005 12:43:28 -0300, "Cesar Ronchese" <info||carsoftnet.com.br> wrote:
Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
I can give a try on it (when I was programming in VB6 I noticed it freeze
the application).
I'll see if works well in .Net, multithreading it.
Thx
Cesar
"Michael D. Ober" <obermd.@.alum.mit.edu.nospam> wrote in message
news:e$**************@TK2MSFTNGP10.phx.gbl... If you can get a handle to the application you're waiting on, you can have the OS block your thread until that handle signals using the WaitForSingleObject API. You'll need to do this is in a worker thread as all Wait Functions block their thread.
Mike Ober.
"Cesar Ronchese" <info||carsoftnet.com.br> wrote in message news:ek**************@TK2MSFTNGP10.phx.gbl... Hey all.
I need a improved code that waits for a execution before an another precedure terminate processing. Nowadays, I use the following code:
(...) 'executing some new threaded function...
'loop While Not ThatFunctionTerminated System.Windows.Forms.Application.DoEvents() Syste.Threading.Thread.Sleep(1) End While
(...) 'code to response to user...
But this code devoures some CPU processing.
There are some inbuilt method that waits for a procedure execution, with no UI locking?
That loop runs in a server application, so that can be called many times at same time. And the administrator need to be able to open the server application and work with it, with no UI locking.
Cesar
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ido Zur |
last post by:
The problem:
We have ASP application that uses WSC as data access tier
to SQL Server, and it runs well on windows 2000 server
IIS 5.0.
When we install the application on XP with IIS 5.1 the...
|
by: Serge |
last post by:
Hi,
I am having a thread hang problem in my c# code.
The example on the website: http://csharp.web1000.com/ is a
simplified version of my problem.
You will see in the form that a...
|
by: Madhu Gopinathan |
last post by:
Hi All,
I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor....
|
by: caesarchen |
last post by:
Dear all:
The following is the situation,can any one share me idea to solve it?
Windows 2000 + IIS6.0 + .NET Framework 1.1
6 projects, about 800 webforms and 300 .asmx programs
Project cowork...
|
by: happyinst |
last post by:
I have recently added some code to a web application and now I find it
hanging after I do about 2 or 3 postbacks within the application. It hangs
after
doing different things (I cannot find...
|
by: John Tenney |
last post by:
If I have a windows form (System.Windows.Forms.Form) open and I push the pin
on the toolbox to keep the docked window open, Visual Studios 2003 pegs the
processor and basically hangs my computer. I...
|
by: Jeff |
last post by:
Banging my head against the wall trying to figure this out. I have a
'sometimes' hang while disposing a form which contains an ActiveX
control (Flash.ocx version 7). The form's Dispose() method...
|
by: Michael Maes |
last post by:
Hi,
We have a windows service passing objects to a client application by
remoting.
The windows service is started and running successfully.
* When the client app is running on the same...
|
by: wingsss |
last post by:
i am currently using
WindowsXP SP2 all updated
apache 2.2.4
PHP 5.2.3
MySQL 5.0
and apache hang up when running this code
//...
|
by: alivip |
last post by:
when I wont to inser (anyting I print) to the textbox it will not inser
it just print then hanging
# a look at the Tkinter Text widget
# use ctrl+c to copy, ctrl+x to cut selected text,
#...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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,...
|
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...
|
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: 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...
|
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,...
| |