|
Boost : |
From: helmut.zeisel_at_[hidden]
Date: 2001-10-11 13:09:46
--- In boost_at_y..., Darin Adler <darin_at_b...> wrote:
>
>
> I just realized we don't need to put the thing into a struct. We can
just
> pass &func to pthread_setspecific and do:
>
So the patch reduces now to:
@@ -38,8 +38,8 @@
static void do_once()
{
- once_callback cb =
reinterpret_cast<once_callback>(pthread_getspecific(key));
- (*cb)();
+ once_callback* cb =
static_cast<once_callback*>(pthread_getspecific(key));
+ (**cb)();
}
}
@@ -85,7 +85,8 @@
}
#elif defined(BOOST_HAS_PTHREADS)
pthread_once(&once, &key_init);
- pthread_setspecific(key, func);
+ once_callback w = func;
+ pthread_setspecific(key, &w);
pthread_once(&flag, do_once);
#endif
}
It works with the test program.
>
> My apologies for spending so much list bandwidth on this minor
coding issue.
>
Since the source code is now smaller,
the lost bandwidth might be compensated in the future ;-)
Helmut
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk