Mikolaj Golub
2009-Nov-24 14:53 UTC
pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop
Hi, I have problems with compiling our application under 8.0. It fails due to these definitions in pthread.h that look like a typo or incorrectly applied patch: 170 #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ 171 { \ 172 struct _pthread_cleanup_info __cleanup_info__; \ 173 __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ 174 &__cleanup_info__); \ 175 { 176 177 #define pthread_cleanup_pop(execute) \ 178 } \ 179 __pthread_cleanup_pop_imp(execute); \ 180 } This patch fixes the problem for me: --- pthread.h.orig 2009-11-24 16:44:13.000000000 +0200 +++ pthread.h 2009-11-24 16:44:45.000000000 +0200 @@ -172,10 +172,10 @@ struct _pthread_cleanup_info __cleanup_info__; \ __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ &__cleanup_info__); \ - { + } #define pthread_cleanup_pop(execute) \ - } \ + { \ __pthread_cleanup_pop_imp(execute); \ } -- Mikolaj Golub
pluknet
2009-Nov-24 15:14 UTC
pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop
2009/11/24 Mikolaj Golub <to.my.trociny@gmail.com>:> Hi, > > I have problems with compiling our application under 8.0. > > It fails due to these definitions in pthread.h that look like a typo or > incorrectly applied patch: > > ? ?170 #define ? ? ? ? pthread_cleanup_push(cleanup_routine, cleanup_arg) ? ? ? ? ? ? ?\ > ? ?171 ? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \ > ? ?172 ? ? ? ? ? ? ? ? ? ? ? ? struct _pthread_cleanup_info __cleanup_info__; ? ? ? ? ?\ > ? ?173 ? ? ? ? ? ? ? ? ? ? ? ? __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ > ? ?174 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &__cleanup_info__); ? ? ? ? ? ? ? ? ? ? ? ? ? ? \ > ? ?175 ? ? ? ? ? ? ? ? ? ? ? ? { > ? ?176 > ? ?177 #define ? ? ? ? pthread_cleanup_pop(execute) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\ > ? ?178 ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \ > ? ?179 ? ? ? ? ? ? ? ? ? ? ? ? __pthread_cleanup_pop_imp(execute); ? ? ? ? ? ? ? ? ? ? \ > ? ?180 ? ? ? ? ? ? ? ? } >Hi. No, this is made intentionally. P.S. I don't understand the reason in the second brackets pair though (lines 175,178), maybe these are because of comment to v1.43.. -- wbr, pluknet
Mikolaj Golub
2009-Nov-24 15:18 UTC
pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop
On Tue, 24 Nov 2009 16:53:35 +0200 Mikolaj Golub wrote:> Hi, > > I have problems with compiling our application under 8.0. > > It fails due to these definitions in pthread.h that look like a typo or > incorrectly applied patch: > > 170 #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ > 171 { \ > 172 struct _pthread_cleanup_info __cleanup_info__; \ > 173 __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ > 174 &__cleanup_info__); \ > 175 { > 176 > 177 #define pthread_cleanup_pop(execute) \ > 178 } \ > 179 __pthread_cleanup_pop_imp(execute); \ > 180 } > > > This patch fixes the problem for me:I was hurry when said that the patch fixed the problem. The application compiled but later it crashed in pthread_cleanup_pop: (gdb) bt #0 0xbf4f9ee0 in ?? () #1 0x287d18c9 in __pthread_cleanup_pop_imp () from /lib/libthr.so.3 #2 0x287d18ed in pthread_cleanup_pop () from /lib/libthr.so.3 #3 0x287d123c in pthread_exit () from /lib/libthr.so.3 #4 0x287c7757 in pthread_getprio () from /lib/libthr.so.3 #5 0x00000000 in ?? () So, I don't know what these macros actually were supposed to be. They were introduced in r179662: Revision 1.43: download - view: text, markup, annotated - select for diffs Mon Jun 9 01:14:10 2008 UTC (17 months, 2 weeks ago) by davidxu Branches: MAIN Diff to: previous 1.42: preferred, colored Changes since revision 1.42: +21 -2 lines SVN rev 179662 on 2008-06-09 01:14:10Z by davidxu Make pthread_cleanup_push() and pthread_cleanup_pop() as a pair of macros, use stack space to keep cleanup information, this eliminates overhead of calling malloc() and free() in thread library. Discussed on: thread@> --- pthread.h.orig 2009-11-24 16:44:13.000000000 +0200 > +++ pthread.h 2009-11-24 16:44:45.000000000 +0200 > @@ -172,10 +172,10 @@ > struct _pthread_cleanup_info __cleanup_info__; \ > __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ > &__cleanup_info__); \ > - { > + } > > #define pthread_cleanup_pop(execute) \ > - } \ > + { \ > __pthread_cleanup_pop_imp(execute); \ > }-- Mikolaj Golub
Mark Andrews
2009-Nov-24 21:14 UTC
pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop
Report it using "send-pr". That way the problem will make its way into the bug tracking system. In message <86aayc7z4g.fsf@zhuzha.ua1>, Mikolaj Golub writes:> Hi, > > I have problems with compiling our application under 8.0. > > It fails due to these definitions in pthread.h that look like a typo or > incorrectly applied patch: > > 170 #define pthread_cleanup_push(cleanup_routine, cleanup_arg) > \ > 171 { > \ > 172 struct _pthread_cleanup_info __cleanup_info__; > \ > 173 __pthread_cleanup_push_imp(cleanup_routine, clean > up_arg,\ > 174 &__cleanup_info__); > \ > 175 { > 176 > 177 #define pthread_cleanup_pop(execute) > \ > 178 } > \ > 179 __pthread_cleanup_pop_imp(execute); > \ > 180 } > > > This patch fixes the problem for me: > > --- pthread.h.orig 2009-11-24 16:44:13.000000000 +0200 > +++ pthread.h 2009-11-24 16:44:45.000000000 +0200 > @@ -172,10 +172,10 @@ > struct _pthread_cleanup_info __cleanup_info__; \ > __pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\ > &__cleanup_info__); \ > - { > + } > > #define pthread_cleanup_pop(execute) > \ > - } \ > + { \ > __pthread_cleanup_pop_imp(execute); \ > } > > -- > Mikolaj Golub > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"-- Mark Andrews, ISC 1 Seymour St., Dundas Valley, NSW 2117, Australia PHONE: +61 2 9871 4742 INTERNET: marka@isc.org
Daniel Eischen
2009-Nov-24 21:29 UTC
pthread.h: typo in #define pthread_cleanup_push/pthread_cleanup_pop
On Wed, 25 Nov 2009, Mark Andrews wrote:> > Report it using "send-pr". That way the problem will make its way into the > bug tracking system. > > In message <86aayc7z4g.fsf@zhuzha.ua1>, Mikolaj Golub writes: >> Hi, >> >> I have problems with compiling our application under 8.0. >> >> It fails due to these definitions in pthread.h that look like a typo or >> incorrectly applied patch:Did someone already reply to this? I think the problem is in your application. You cannot have push and pop at different nesting levels. The start brace in the push is ended by the end brace in pop on purpose. It is to enforce nesting levels.>> >> 170 #define pthread_cleanup_push(cleanup_routine, cleanup_arg) >> \ >> 171 { >> \ >> 172 struct _pthread_cleanup_info __cleanup_info__; >> \ >> 173 __pthread_cleanup_push_imp(cleanup_routine, clean >> up_arg,\ >> 174 &__cleanup_info__); >> \ >> 175 { >> 176 >> 177 #define pthread_cleanup_pop(execute) >> \ >> 178 } >> \ >> 179 __pthread_cleanup_pop_imp(execute); >> \ >> 180 }-- DE