Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can I implement pthread_cleanup_push without a macro?

0
Posted

Can I implement pthread_cleanup_push without a macro?

0

I was about to use pthread_cleanup_push, when I noticed that it is implemented as a macro (on Solraris 2.5) which forces you to have the pthread_cleanup_pop in the same function by having an open brace { at the end of the first macro and closing it int the second… Since I want to hide most of this stuff in something like a monitor (or a guard in ACE) in C++ by using the push in a constructor and the pop in the destructor I’m wondering if there is something fondamental that would prevent me to do so or could I just re-implement the stuff done by the macros inside some class services. POSIX 1003.1c-1995 specifies that pthread_cleanup_push and pthread_cleanup_pop must be used at the same lexical scope, “as if” the former were a macro that expands to include an opening brace (“{“) and the latter were a macro that expands to include the matching closing brace (“}”). The Solaris 2.5 definition therefore conforms quite accurately to the intent of the standard. And so does the Digital UNIX d

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123