Thank you Ali,
Indeed, I originally had the function outside of main.
I have found another strange result with std.concurrency:
spawn(&function, array[0].length, array.length);
// generates compiling error: "cannot deduce template function
from arg types"
//Yet,
int var_one = array[0].length;
int var_two = array.length;
spawn(&function, var_one, var_two);
// compiles and runs
On Thursday, 18 October 2012 at 17:52:09 UTC, Ali Çehreli wrote:
On 10/17/2012 07:46 PM, drpepper wrote:
I want the function below to run independently -- like a unix
background process, without delaying subsequent code in main. I
tried the following using std.parallelism:
void main() {
function_a(int a, int b) {
...
}
auto new_task = task!function_a(11, 12);
new_task.executeInNewThread(1);
// more code ...
}
I get errors: core.thread.ThreadException ... unable to set
thread priority ...
I am not sure whether it is supposed to be, but the function
must be a module-level function; so define it outside of main.
When I did that, there was segmentation fault if I used thread
priority.
Workaround:
1) Take function out of main
2) Do not specify thread priority
Created bug report:
http://d.puremagic.com/issues/show_bug.cgi?id=8849
Ali