shared variables in parfor()
Max Alekseyev <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <CAJkPp5PSKWvnex9JchT3syYFifbyra7NeZNf+WVxa2TWzLNq7g@mail.gmail.com> |
Hello, I naively thought that the following code would print a few zeros, which would then follow by all ones: my(q=0); parfor(i=1,10^6, print(q); 0, R, q=1) but it constantly prints zeros. So, the value of q is not shared between threads. What is the right way to create a shared variable (with pthreads if that matters)? Regards, Max