lkml.org 
[lkml]   [2004]   [Jan]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSun, 4 Jan 2004 21:06:06 -0800 (PST)
FromDavide Libenzi <>
SubjectRe: [PATCH 1/2] kthread_create
On Mon, 5 Jan 2004, Rusty Russell wrote:

> In message <Pine.LNX.4.44.0401041501510.12666-100000@bigblue.dev.mdolabs.com> you write:
> > I can see two options:
> > 
> > 1) We do not allow do_exit() from kthreads
> > 
> > 2) We give kthread_exit()
> > 
> > What do you think?
> 
> Well, I've now got a patch which works without any global
> datastructures, but still allows the same semantics.  Includes some
> fixes in the previous code, and test code.
> 
> Also includes a longstanding fix in workqueue.c: we never get SIGCHLD
> if signal handler is SIG_IGN.
> 
> I'm not sure it's neater, though.  We don't have WIFEXITED() in the
> kernel, so lots of manual shifting, probably should add that
> somewhere.
> 
> Thoughts?

Honestly I do not like playing with SIGCLD/waitpid for things that do not 
concern real task exits. But I think it can be avoided, and actually I 
don't know why I did not think about this before. We don't need to return 
a struct task_struct* for kthread_create(). We can have:

struct kthread_struct {
	struct task_struct *tsk;
	int ret;
	struct semaphore ack; /* Or completion if you like */
};
This structure is allocated in kthread_create() and propagated to the 
kthread() void* data. Then they (the creator and the kthread) will have a 
common ground to exchange acks w/out playing with SIGCLD/waitpid. Heh ?



- Davide


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:59    [from the cache]
©2003-2008