[K42-discussion] Thread object destructor
Bryan S Rosenburg
rosnbrg at us.ibm.com
Sun Jul 16 08:33:23 EST 2006
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. 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?
- Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/k42-discussion/attachments/20060715/ccf0044c/attachment.htm
More information about the K42-discussion
mailing list