[K42-discussion] Thread object destructor
Donour Sizemore
donour at cs.unm.edu
Sun Jul 16 09:11:23 EST 2006
Bryan S Rosenburg wrote:
>
>
> Donour Sizemore wrote on 07/15/2006 05:01:40 PM:
> > Does anybody know why adding a destructor to the base thread object
> > (Thread) would cause the things to overrun the stack fence?
> According to
> > strategically placed err_printf's, the destructor is never actually
> > getting called.
>
> The base Thread class has no virtual methods, so adding a virtual
> destructor causes the class to have a vtable pointer where it didn't
> before. The "attachment" field may then no longer be the very first
> word of the structure.
Oh. Duh, I should have seen that. thanks.
> Code in the Linux module that we import into K42 requires that the
> attachment field be the first word. This requirement is documented
> (but unfortunately not enforced) in lib/libc/scheduler/Thread.H. I'm
> guessing that your stack overflow is a consequence of violating this
> assumption. Do you really need a virtual destructor in class Thread?
No actually I don't. ThreadMigratable needs one, but I added it to
Thread by mistake.
donour
More information about the K42-discussion
mailing list