lkml.org 
[lkml]   [2000]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] pcmcia event thread. (fwd)
David Woodhouse wrote:
> jgarzik@mandrakesoft.com said:
> > Racy. Use waitpid() in the thread killer instead.
>
> Doesn't waitpid() require the thread we're waiting for to be child of the
> rmmod process? I suppose we could arrange that, but it's not particularly
> clean.

Doh, totally forgot about that. Will this work:

save_current = current;
current = find_task_by_pid(1);
waitpid(...);
current = save_current;

In any case, we -really- need a wait_for_kernel_thread_to_die()
function.


> jgarzik@mandrakesoft.com said:
> > Why are you cloning _FS, _FILES, and _SIGHAND? I don't see why the
> > third arg should not be zero. man clone...
>
> If we don't specify CLONE_FS | CLONE_FILES | CLONE_SIGHAND then new ones
> get allocated just for us to free them again immediately. If we clone them,
> then we just increase and decrease the use counts of the parent's ones. The
> latter is slightly more efficient, and I don't think it really matters. If
> you really care, that can be changed. I've dropped CLONE_SIGHAND because
> daemonize() doesn't free that, but left CLONE_FS and CLONE_FILES.

Cool tip, thanks.


> + spin_lock_irq(&current->sigmask_lock);
> + sigfillset(&current->blocked);
> + recalc_sigpending(current);
> + spin_unlock_irq(&current->sigmask_lock);

what does this do?


> + /* Start the thread for handling queued events for socket drivers */
> + event_thread_pid = kernel_thread (pcmcia_event_thread, NULL, CLONE_FS | CLONE_FILES);
> +
> + if (event_thread_pid < 0) {
> + printk(KERN_ERR "init_pcmcia_cs: fork failed: errno %d\n", -event_thread_pid);
> + return event_thread_pid;
> + }

why do you store the event_thread_pid but never use it?

regards,

Jeff


--
Jeff Garzik |
Building 1024 | The chief enemy of creativity is "good" sense
MandrakeSoft | -- Picasso
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.157 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site