且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

挂在代码上?

更新时间:2023-01-30 22:00:44

Cesar,

1毫秒不是那么多


:-))


Cor


" Cesar Ronchese" <信息|| carsoftnet.com.br> schreef in bericht

新闻:ek ************** @ TK2MSFTNGP10.phx.gbl ...
嘿所有。

我需要一个改进的代码,在另一个
precedure终止处理之前等待执行。
现在,我使用以下代码:

(.. 。)''执行一些新的线程函数......

'循环
而不是那个函数终止
System.Windows.Forms.Application.DoEvents()
Syste .Threading.Thread.Sleep(1)
结束时

(...)''代码响应用户...

但这段代码吞噬一些CPU处理。

有一些内置方法等待程序执行,没有UI锁定?

该循环在服务器应用程序中运行,所以可以同时多次调用
。并且管理员需要能够打开服务器
应用程序并使用它,没有UI锁定。

Cesar



嗯,我猜这段代码占用了太多CPU。通过你的回答,

那段代码已经是正确的做法了吗?


" Cor Ligthert [MVP]" <无************ @ planet.nl>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP15.phx.gbl ...
Cesar,

1毫秒不是那么多

:-)


Cesar Ronchese <信息|| carsoftnet.com.br> schreef in bericht
新闻:ek ************** @ TK2MSFTNGP10.phx.gbl ...
嘿所有。

precedure终止处理之前等待执行。
现在,我使用以下代码:

(...)''执行一些新的线程函数...

''循环
而不是那个函数终止版
System.Windows.Forms.Application.DoEvents()
Syste.Threading.Thread .Sleep(1)
结束时

(...)''代码响应用户...

但是这段代码吞噬了一些CPU处理。

有一些内置方法等待程序执行,
没有UI锁定?

该循环在服务器应用程序中运行,因此可以调用很多次同时
。并且管理员需要能够打开服务器
应用程序并使用它,没有UI锁定。

Cesar




Cesar,


我是这么认为的,但我会用50毫秒minium来尝试它


Cor
好吧,我猜这段代码占用了太多CPU。通过你的回答,
代码已经是正确的做法了?



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,

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?