For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > June 2007 > NPTL, C++ and Cleanup









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author NPTL, C++ and Cleanup
uljanow

2007-06-19, 4:16 am

hi,
I was wondering why in the following code example the destructor isn't
called by the cleanup handler:
....
struct foo;

void* thread_start(void*) {
foo* ptr = new foo;
pthread_cleanup_push((operator delete), ptr);
// Do something
pthread_cleanup_pop(0);
return NULL;
}

struct foo {
int a, b, c;
foo() {}
~foo() { fprintf(stderr, "destruc\n"); }
};
.....
Using another function which just calls delete works however.

Regards
S. Sakar

Maxim Yegorushkin

2007-06-19, 4:16 am

On 19 Jun, 08:30, uljanow <ssa...@gmx.de> wrote:

> I was wondering why in the following code example the destructor isn't
> called by the cleanup handler:
> ...
> struct foo;
>
> void* thread_start(void*) {
> foo* ptr = new foo;
> pthread_cleanup_push((operator delete), ptr);
> // Do something
> pthread_cleanup_pop(0);
> return NULL;
>
> }
>
> struct foo {
> int a, b, c;
> foo() {}
> ~foo() { fprintf(stderr, "destruc\n"); }};
>
> ....
> Using another function which just calls delete works however.


You may be confusing C++ keyword delete with operator delete, which
are different things. For more info please see
http://groups.google.co.uk/group/co...769651f6c9ba195



uljanow

2007-06-19, 4:16 am

> You may be confusing C++ keyword delete with operator delete, which
> are different things. For more info please see
> http://groups.google.co.uk/group/co...769651f6c9ba195

Thanks, not knowing the difference was the problem.
I think I'll use auto_ptr's instead.

Hash

2007-06-21, 1:36 am

Alyssa Milano and Sarah M. Gellar , Petting Slits!
http://www.shockingtheworld.com/watch?watch=726071

hot pussy video oral sex porn video hollywood video austin zoo movie camera home security video
porn movie gratis 2 300 movie trailer windows movie maker britney fling lesbian spear torpedos gratis
movie maker 2 download free lesbian video girl gone wild free video converter imtoo ipod video xxx hardcore movie sample
michael jackson fan club interracial sex video free porn star video sample amazing clip funny video video largos de porn gratis

free long sex video
video game trailer
adult download jap video
free granny sexe movie
movie lesbian scena
video gratis de transexuales
free knot music slip video
free hot movie online tv
adult video planet
converter file google video
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com