| 8 | int isync[256],mthreadnum,iam; |
| 9 | #pragma omp threadprivate(mthreadnum,iam) |
| 10 | void sync_left() |
| 11 | { |
| 12 | int neighbour; |
| 13 | if(iam>0&&iam<=mthreadnum) |
| 14 | { |
| 15 | neighbour=iam-1; |
| 16 | while(isync[neighbour]==0) |
| 17 | { |
| 18 | #pragma omp flush(isync) |
| 19 | } |
| 20 | isync[neighbour]=0; |
| 21 | #pragma omp flush(isync,a) |
| 22 | } |
| 23 | } |
| 24 | void sync_right() |
| 25 | { |
| 26 | if(iam<mthreadnum) |