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

creating a delay

Hello:

I was wondering if someone might have a recommendation for creating a delay
within the execution of a .dll.

Currently I am using an empty for/next loop and it takes about 1 billion
cycles seems to create a 1 second delay (I know, probably not a good idea).

I was considering thread.sleep() but don't want to create any unintentional
side effects. Would this be a good idea or are there better options?

Thanks!

Chris
Nov 15 '05 #1
4 1712
What other side effects do you think it might create?

Sleep is the recommended method of delay. Looping forever will choke the
CPU and starve other lower priority threads.

If you are waiting for something, use Synchronization.

-vJ

"ChrisB" <pl****************@thanks.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Hello:

I was wondering if someone might have a recommendation for creating a delay within the execution of a .dll.

Currently I am using an empty for/next loop and it takes about 1 billion
cycles seems to create a 1 second delay (I know, probably not a good idea).
I was considering thread.sleep() but don't want to create any unintentional side effects. Would this be a good idea or are there better options?

Thanks!

Chris

Nov 15 '05 #2
ChrisB wrote:
Hello:

I was wondering if someone might have a recommendation for creating a
delay within the execution of a .dll.
What's the delay for?
I was considering thread.sleep() but don't want to create any
unintentional side effects. Would this be a good idea or are there
better options?


Unless you're modifying data within the thread, I don't see a problem.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #3
Thread.Sleep() is great for this sort of thing - it's exactly what it is
designed for.

Greg

This posting is provided "AS IS"with no warranties, and confers no rights.

Nov 15 '05 #4
Thanks to everyone for the advice.

I am creating the delay for a test component so that information is written
to a database at specified intervals - sounds like thread.sleep() is the way
to go.

I'll give it a try . . .

Chris

"Greg Beech [MSFT]" <gr*****@online.microsoft.com> wrote in message
news:LW**************@cpmsftngxa06.phx.gbl...
Thread.Sleep() is great for this sort of thing - it's exactly what it is
designed for.

Greg

This posting is provided "AS IS"with no warranties, and confers no rights.

Nov 15 '05 #5

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

Similar topics

1
by: asdasd | last post by:
Hello there, I'm hoping someone might be able to help me out. Its been awhile since I've programmed in visual basic (and roughly at that)... I want to create a program that will allow me to...
14
by: Des L. Davis | last post by:
System: Dell PowerEdge Server with 3 GB RAM, 2.4 GHz Celeron Software: Microsoft SQL Server 2000 Enterprise running on Windows 2003 Server Software: Microsoft SQL Server 2000 Enterprise running on...
1
by: David Li | last post by:
I am having a lot of problem with following code. To start with I have a working sets of code and the top level SystemC code looks like this: ----------working main.cpp start here...
6
by: lucifer | last post by:
hi i need to insert delay in my program what function should i use the old delay is not supported by the VC6
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
1
by: CES | last post by:
All, I was wondering if someone could point me to a tutorial on creating & accessing functions from within a wrapper function. I've created a group of functions related to a timer event. All...
8
by: dd | last post by:
Has anyone found a way around the problem IE has if you create elements (script or div, doesn't seem to matter) BEFORE the document.readyState is "complete" ? I know you can sometimes get away...
1
by: =?Utf-8?B?Q3JlYXRpbmcgZGVsYXkgZm9yIHRvb2x0aXA=?= | last post by:
I am using 'title' attribute of Anchor tag (<A>) for creating a tooltip.I need to show the tooltip for 25 seconds.Can anybody help please me out in creating a delay? Thanks
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...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
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.