independent or parallel process
Ali Çehreli
acehreli at yahoo.com
Thu Oct 18 10:52:09 PDT 2012
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
More information about the Digitalmars-d-learn
mailing list