Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 2009 17:47:42 +0200
From:      Mikolaj Golub <to.my.trociny@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        FreeBSD Stable <freebsd-stable@freebsd.org>
Subject:   Re: pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop
Message-ID:  <861vjn9b6p.fsf@zhuzha.ua1>
In-Reply-To: <20091124153422.GT2331@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Tue\, 24 Nov 2009 17\:34\:22 %2B0200")
References:  <86aayc7z4g.fsf@zhuzha.ua1> <8663907xyy.fsf@zhuzha.ua1> <20091124153422.GT2331@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 24 Nov 2009 17:34:22 +0200 Kostik Belousov wrote:

> pthread_cleanup_push/pop are supposed to be used from the common
> lexical scope. Citation from SUSv4:
>
> These functions may be implemented as macros. The application shall
> ensure that they appear as statements, and in pairs within the same
> lexical scope (that is, the pthread_cleanup_push() macro may be
> thought to expand to a token list whose first token is '{' with
> pthread_cleanup_pop() expanding to a token list whose last token is the
> corresponding '}' ).
>
> Your change is wrong.
>
> Basically, the code should do
> 	pthread_cleanup_push(some_func, arh);
> 	something ...
> 	pthread_cleanup_pop(1);
> (1 denotes that some_func should be called).

I see. Thank you. So it really looks like a bug in our application as
pthread_cleanup_pop(1) is missed. I will tell our developers :-)

-- 
Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?861vjn9b6p.fsf>