delayed-execution

Linux Kernel: udelay() returns too early?

…衆ロ難τιáo~ 提交于 2019-12-04 05:50:46
I have a driver which requires microsecond delays. To create this delay, my driver is using the kernel's udelay function. Specifically, there is one call to udelay(90): iowrite32(data, addr + DATA_OFFSET); iowrite32(trig, addr + CONTROL_OFFSET); udelay(30); trig |= 1; iowrite32(trig, addr + CONTROL_OFFSET); udelay(90); // This is the problematic call We had reliability issues with the device. After a lot of debugging, we traced the problem to the driver resuming before 90us has passed. (See "proof" below.) I am running kernel version 2.6.38-11-generic SMP (Kubuntu 11.04, x86_64) on an Intel

A variable used in its own definition?

我们两清 提交于 2019-12-03 12:27:21
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. It's not always a recursive definition. This actually works and produces 1: val a : Int = a + 1 println(a) variable a is created when you type val a: Int , so you can use it in the definition. Int is initialized to 0 by default. A class will be null. As @Chris pointed out, Stream accepts => Stream[A] so a bit another rules are applied, but I wanted to explain general case. The idea is still the same, but

Force an IQueryable to execute?

[亡魂溺海] 提交于 2019-12-03 11:35:08
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? Is the problem that you want your method to execute locally rather than in the database? If so, AsEnumerable is your friend. It's a very simple method, something like: public IEnumerable<T> AsEnumerable(IEnumerable<T> source) { return source; } The important thing is that it makes the compile-time type of the result IEnumerable<T> rather than IQueryable<T> , which means any LINQ query operators you

Force Linq to not delay execution

天大地大妈咪最大 提交于 2019-12-03 11:01:21
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 similar-but-better-explained problem: I have a handful of threads in two types (ignoring UI threads for a moment). There's a "data-gathering" thread type, and a "computation" thread type. The data gathering threads are slow. There's a quite a bit of data to be sifted through from a variety of places. The computation threads are comparatively fast.

How can I make sure my LINQ queries execute when called in my DAL, not in a delayed fashion?

不想你离开。 提交于 2019-12-01 16:06:57
I have a DAL that is composed of a bunch of methods that perform LINQ queries on my database. How do I ensure that before returning say an IEnumberable or something similar from the database, I ensure that the LINQ query is execute then , not in some delayed fashion only to be executed when the result is used? I know I can call .ToList() on my result in my methods to force it to execute, but is this the best way? Calling ToList or ToArray really is the best way to force it to execute and get the entire sequence (see Randolpho's comment below for other methods that will force execution for

How can I make sure my LINQ queries execute when called in my DAL, not in a delayed fashion?

跟風遠走 提交于 2019-12-01 15:25:17
问题 I have a DAL that is composed of a bunch of methods that perform LINQ queries on my database. How do I ensure that before returning say an IEnumberable or something similar from the database, I ensure that the LINQ query is execute then , not in some delayed fashion only to be executed when the result is used? I know I can call .ToList() on my result in my methods to force it to execute, but is this the best way? 回答1: Calling ToList or ToArray really is the best way to force it to execute and

PHP sleep delay

淺唱寂寞╮ 提交于 2019-11-30 04:28:20
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 this? Use PHP sleep() function. http://php.net/manual/en/function.sleep.php This stops execution of next loop for the given number of seconds. So something like this for ($i=0; $i <= 10; $i++) { $file_exists=file_exists($location.$filename); if($file_exists) { break; } sleep(3); // this should halt for 3 seconds for every loop } I see what you are doing... your delaying a script

Can you perform a delayed set (:= in Mathematica) in Matlab?

耗尽温柔 提交于 2019-11-29 14:15:38
So, I've recently converted from Mathematica to Matlab, and while Matlab has most of Mathematica's useful features, I can't figure out how to perform the equivalent of Mathematica's delayed set operation ':=' which assigns a variable a value in a lazy fashion. For example, in Mathematica: y = 2; x := y; y = 3; x would give the value of x as 3, whereas the only way I can get this same behavior in Matlab is: y = 2; x = @()(y); y = 3; x() which, while technically answering my question, is a pretty ad hoc work around and requires treating x as a function. So is there a more natural way to do this

PHP sleep delay

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 01:44:52
问题 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 this? 回答1: Use PHP sleep() function. http://php.net/manual/en/function.sleep.php This stops execution of next loop for the given number of seconds. So something like this for ($i=0; $i <= 10; $i++) { $file_exists=file_exists($location.$filename); if($file_exists) { break; }

Can you perform a delayed set (:= in Mathematica) in Matlab?

為{幸葍}努か 提交于 2019-11-28 08:01:37
问题 So, I've recently converted from Mathematica to Matlab, and while Matlab has most of Mathematica's useful features, I can't figure out how to perform the equivalent of Mathematica's delayed set operation ':=' which assigns a variable a value in a lazy fashion. For example, in Mathematica: y = 2; x := y; y = 3; x would give the value of x as 3, whereas the only way I can get this same behavior in Matlab is: y = 2; x = @()(y); y = 3; x() which, while technically answering my question, is a