likecs
likecs

Reputation: 363

Reentrantlock in openmp

I heard about Reentrantlock recently which are available in Java. But I was trying to implement parallel data structures like priority queues using openmp and C++.

I was curious to know whether a similar equivalent exists in openmp and C++ or whether it can be implemented using pthreads? If there exists such an equivalent, please tell how to use it.

Upvotes: 1

Views: 160

Answers (1)

Jim Cownie
Jim Cownie

Reputation: 2869

See the description of omp_nest_lock on page 270 (PDF page 279) in the OpenMP 4.5 standard.

A meta-question is "Why are you doing this?"
Why aren't you simply using something like TBB's Concurrent Priority Queue?
Do you need to be using OpenMP for other reasons?
Is this is for your own education?
If not, then TBB might be a simpler approach (it is now Apache Licensed).

(FWIW I work for Intel, who wrote TBB, but I work on OpenMP, not TBB :-))

Upvotes: 1

Related Questions