deferred-execution

What is the best way to defer code execution?

I have many methods calling each other that each have to certain tasks, some of them asynchronous, that all operate on a DOM (so only one thread must access the DOM at any time). For example: object A() { /*...A() code 1...*/ var res = B(); /*...A() code 2 that uses res...*/ } object B() { /*...B code 1...*/ var re...

Task Chaining with Cursor issue on app engine. Exception: Too big query offset. Anyone else get this issue?

Hi, I'm not sure if anyone else has this problem, but I'm getting an exception "Too big query offset" when using a cursor for chaining tasks on appengine development server (not sure if it happens on live). The error occurs when requesting a cursor after 4000+ records have been processed in a single query. I wasn't aware that offsets ...

twisted: difference between `defer.execute` and `threads.deferToThread`

What is the difference between defer.execute() and threads.deferToThread() in twisted? Both take the same arguments - a function, and parameters to call it with - and return a deferred which will be fired with the result of calling the function. The threads version explicitly states that it will be run in a thread. However, if the defe...

Linq - What is the quickest way to find out deferred execution or not?

What is the quickest way to find out which .net framework linq methods (e.g .IEnumerable linq methods) are implemented using deferred execution vs. which are not implemented using deferred execution. While coding many times, I wonder if this one will be executed right way. The only way to find out is go to MSDN documentation to make su...

Returning IEnumerable with using

Interesting problem I ran across which makes total sense. I have a generic method like so: public TResult Run<TResult>(Func<SqlDataReader, TResult> resultDelegate) { TResult result; using (SqlDataReader reader = command.ExecuteReader()) // command is SqlCommand with attached SqlConnection { result = resultsDelegate(read...

Check if return type is IEnumerable<T>

How can I check if the return type of a function is IEnumerable<T>? In other words, I don't want to match List<T>, even though it implements IEnumerable<T>. Or put even another way, how can I detect if a function has deferred execution? ...