Questions tagged [delayed-execution]

Delaying the execution of a program or a procedure by a given amount of time, or until the results are explicitly requested.

Delaying the execution of a program or a procedure by a given amount of time, or until the results are explicitly requested.

259 questions
60
votes
6 answers

Compare using Thread.Sleep and Timer for delayed execution

I have a method which should be delayed running for a specified amount of time. Should I use Thread thread = new Thread(() => { Thread.Sleep(millisecond); action(); }); thread.IsBackground = true; thread.Start(); Or Timer timer = new…
31
votes
5 answers

PHP sleep delay

In PHP, I want to put a number of second delay on each iteration of the loop. for ($i=0; $i <= 10; $i++) { $file_exists=file_exists($location.$filename); if($file_exists) { break; } //sleep for 3 seconds } How can I do…
Yeak
  • 2,177
  • 8
  • 31
  • 60
30
votes
4 answers

what is the difference between thunk, futures, and promises?

There are wiki articles about them: (http://en.wikipedia.org/wiki/Futures_and_promises, http://en.wikipedia.org/wiki/Thunk_(delayed_computation)). But I am not sure what are the exact differences between the three as a programming language concept?…
JRR
  • 5,290
  • 4
  • 32
  • 54
19
votes
4 answers

Force Linq to not delay execution

In fact, this is the same question as this post: How can I make sure my LINQ queries execute when called in my DAL, not in a delayed fashion? But since he didn't explain why he wanted it, the question seems to have been passed over a bit. Here's my…
Clinton Pierce
  • 11,933
  • 12
  • 57
  • 88
18
votes
6 answers

Call a base class constructor later (not in the initializer list) in C++

I'm inheriting a class and I would like to call one of its constructors. However, I have to process some stuff (that doesn't require anything of the base class) before calling it. Is there any way I can just call it later instead of calling it on…
placeholder
  • 183
  • 1
  • 4
17
votes
3 answers

Force an IQueryable to execute?

I have a method that 'has no translation to SQL' that I want to perform on an IQueryable, is there a way to force the IQueryable to execute without having to store it in some intermediate class?
Kirschstein
  • 13,406
  • 13
  • 57
  • 77
12
votes
3 answers

A variable used in its own definition?

An infinite stream: val ones: Stream[Int] = Stream.cons(1, ones) How is it possible for a value to be used in its own declaration? It seems this should produce a compiler error, yet it works.
11
votes
4 answers

Underscore debounce vs vanilla Javascript setTimeout

I understand that debounce in Undercore.js returns a function that will postpone its execution until the wait time is over. My question is, is there an advantage of using debounce over the regular setTimeout function in vanilla Javascript? Don't…
nikjohn
  • 16,079
  • 9
  • 45
  • 78
10
votes
3 answers

How Can I Pass a Member Function to a Function Pointer?

class Child; class Parent { public: void (*funcPointer)(); void (*funcPointer2)(Parent* _this); void (Child::*funcPointer3)(); }; class Child: public Parent { public: void TestFunc(){ } void Do(){ Parent p; …
10
votes
3 answers

Delay Loading DLLs

I am in desperate need of help, I need to manage an application dependency in Visual Studio. The application links to a DLL only on a specific version of windows, lets say Windows 7. and on other environments, the DLL should not be loaded. How will…
Zaid Amir
  • 4,355
  • 4
  • 42
  • 98
9
votes
3 answers

mysql delayed insert timestamp

I have a table with a field:: ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP My question is, if I use delayed insert on this table, will the timestamp be the time when the request is queued or the time when the insert is actually made?
JP19
9
votes
1 answer

Celery task chain cancelling?

I found that celery supports task chains: http://celery.readthedocs.org/en/latest/userguide/canvas.html#chains. Question is: how can I stop chain's execution in a task? For example, we got a chain of N items (N > 2). And in the second task we…
Nikita Hismatov
  • 1,346
  • 1
  • 12
  • 29
8
votes
4 answers

Delay JavaScript's function execution

I have a JQuery's .each loop that calls a function with a parameter per iteration, is there a way to delay this function call? I have tried setTimeout as in the following but this does not work as the function gets executed…
Maya
  • 1,350
  • 3
  • 21
  • 40
8
votes
8 answers

The impossible inline Javascript delay/sleep

There is a JavaScript function, of which I have zero control of the code, which calls a function that I wrote. My function uses DOM to generate an iFrame, defines it's src and then appends it to another DOM element. However, before my function…
trex005
  • 4,637
  • 1
  • 22
  • 39
8
votes
1 answer

Designing Repeating PHP/MySQL Task

I have a design headache here, I'm using PHP and MySQL in conjunction with Java (my project is an Android application). I have to decide how to run a series of server side calculations at regular intervals. There is a wealth of material here on SO…
Chaos
  • 201
  • 1
  • 10
1
2 3
17 18