cvs commit: src/sys/kern kern_thread.c src/sys/sys eventhandler.h

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Nov 24 05:14:06 PST 2007


On Thu, Nov 15, 2007 at 02:20:07PM +0000, Randall Stewart wrote:
> rrs         2007-11-15 14:20:07 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/kern             kern_thread.c 
>     sys/sys              eventhandler.h 
>   Log:
>   - Adds event handlers for process_ctor,process_dtor, process_init,
>     process_fini, thread_ctor, thread_dtor, thread_init, thread_fini. This
>     will allow us to extend dynamically areas in proc/thread for dtrace ;-)

Thanks for doing this, I need such functionality for ZFS. To be precise,
I need to be called when thread is exiting. What I found tricky is that
thread may exit in two ways:

- thread_dtor() when one of many process' threads exists,
- proc_dtor() when the last process' thread exists.

If one wants to attach some data to a thread using this method and then
free the data on thread exit, both those events have to be used. In my
opionion this is confusing (was very confusing for me), that there is no
one place where I can handle thread exit when I don't care about
processes (even if a process is single-threaded we operate on a thread
in the kernel).

In other words, I'd like to propose a bit different solution. IMHO we
should rename events and be them called from the following functions:

event name		called from
----------		-----------
thread_init		thread_init
thread_fini		thread_fini
thread_start		thread_ctor, proc_ctor(?)
thread_exit		thread_dtor, proc_dtor
process_init		proc_init
process_fini		proc_fini
process_start		proc_ctor
process_exit		proc_exit

The only change except for renaming is calling thread_{start,exit} for
the last thread in a process as well.

What do you think?

>   Revision  Changes    Path
>   1.262     +5 -1      src/sys/kern/kern_thread.c
>   1.38      +18 -1     src/sys/sys/eventhandler.h

You forgot to commit changes to kern_proc.c it seems.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20071124/88827a75/attachment.pgp


More information about the cvs-src mailing list