Jump to content

What is the Term for this?


random!@#%

Recommended Posts

  • 1 month later...

What is the programming term for when you delay an action in a line of code? I'm just starting to learn programming and I was going to look up how to do it.

 

delay doing something in a normal program, in C\C++ you do Sleep using OS-specific calls

in Java you use Thread.sleep(..)

 

if you want to delay a procedure, and keep your program running, you assign the work to a thread that

sleeps amount of time .. you may in Java create a new class extending Thread class,

and do Thread.sleep(..) inside, then the action ...

 

if you mean delaying decision of writing line of code, you use ? symbol in the code, and use

back-patch(..) method, which back-patches the ? into codes you decided later ...

Link to comment
Share on other sites

Busy waiting or spinning can be used to generate an arbitrary time delay.

Ew mon, ewmon!

 

Right there in your link it says "In general, however, spinning is considered an anti-pattern and should be avoided, as processor time that could be used to execute a different task is instead wasted on useless activity."

 

Except for the simplest of systems, there is almost always some other mechanism available that is far preferable to a busy loop.

 

Edited by D H
Link to comment
Share on other sites

Ew mon, ewmon!

 

Right there in your link it says "In general, however, spinning is considered an anti-pattern and should be avoided, as processor time that could be used to execute a different task is instead wasted on useless activity."

 

Except for the simplest of systems, there is almost always some other mechanism available that is far preferable to a busy loop.

 

Forgive me, for I am only ewmon. ;) I have also used wait and sleep functions, but I don't know their generic/descriptive names.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.