public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: kenn@linux.ie (Kenn Humborg)
Cc: linux-kernel@vger.kernel.org (Linux-Kernel)
Subject: Re: kernel_thread() & thread starting
Date: Sun, 18 Feb 2001 22:53:16 +0000 (GMT)	[thread overview]
Message-ID: <200102182253.f1IMrHp17404@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20010218222416.D22176@excalibur.research.wombat.ie> from "Kenn Humborg" at Feb 18, 2001 10:24:16 PM

Kenn Humborg writes:
> When starting bdflush and kupdated, bdflush_init() uses a semaphore to
> make sure that the threads have run before continuing.  Shouldn't
> start_context_thread() do something similar?

I think this would be a good idea.  Here is a patch to try.  Please report
back if it works so that it can be forwarded to Linus.  Thanks.

--- orig/kernel/context.c	Tue Jan 30 13:31:11 2001
+++ linux/kernel/context.c	Sun Feb 18 22:51:56 2001
@@ -63,7 +63,7 @@
 	return ret;
 }
 
-static int context_thread(void *dummy)
+static int context_thread(void *sem)
 {
 	struct task_struct *curtask = current;
 	DECLARE_WAITQUEUE(wait, curtask);
@@ -79,6 +79,8 @@
 	recalc_sigpending(curtask);
 	spin_unlock_irq(&curtask->sigmask_lock);
 
+	up((struct semaphore *)sem);
+
 	/* Install a handler so SIGCLD is delivered */
 	sa.sa.sa_handler = SIG_IGN;
 	sa.sa.sa_flags = 0;
@@ -148,7 +150,9 @@
 	
 int start_context_thread(void)
 {
-	kernel_thread(context_thread, NULL, CLONE_FS | CLONE_FILES);
+	DECLARE_MUTEX_LOCKED(sem);
+	kernel_thread(context_thread, &sem, CLONE_FS | CLONE_FILES);
+	down(&sem);
 	return 0;
 }
 


--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2001-02-18 22:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-18 22:24 kernel_thread() & thread starting Kenn Humborg
2001-02-18 22:53 ` Russell King [this message]
2001-02-21  0:51   ` Kenn Humborg
2001-02-19 10:17 ` Philipp Rumpf
2001-02-19 10:32   ` David Woodhouse
2001-02-19 12:44     ` Andrew Morton
     [not found] <Pine.LNX.3.96.1010219073717.16489K-100000@mandrakesoft.mandrakesoft.com>
2001-02-19 21:17 ` Russell King
2001-02-19 21:40   ` Philipp Rumpf
2001-02-19 22:25     ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200102182253.f1IMrHp17404@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=kenn@linux.ie \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox