mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
22 lines
427 B
C
22 lines
427 B
C
/*
|
|
* @@name: tasking.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
struct node {
|
|
struct node *left;
|
|
struct node *right;
|
|
};
|
|
extern void process(struct node *);
|
|
void traverse( struct node *p ) {
|
|
if (p->left)
|
|
#pragma omp task // p is firstprivate by default
|
|
traverse(p->left);
|
|
if (p->right)
|
|
#pragma omp task // p is firstprivate by default
|
|
traverse(p->right);
|
|
process(p);
|
|
}
|