mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
22 lines
324 B
C
22 lines
324 B
C
/*
|
|
* @@name: init_lock.1c
|
|
* @@type: C++
|
|
* @@compilable: yes
|
|
* @@linkable: no
|
|
* @@expect: success
|
|
*/
|
|
#include <omp.h>
|
|
|
|
omp_lock_t *new_locks()
|
|
{
|
|
int i;
|
|
omp_lock_t *lock = new omp_lock_t[1000];
|
|
|
|
#pragma omp parallel for private(i)
|
|
for (i=0; i<1000; i++)
|
|
{
|
|
omp_init_lock(&lock[i]);
|
|
}
|
|
return lock;
|
|
}
|