Page MenuHomeFreeBSD

D44927.diff
No OneTemporary

D44927.diff

diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -495,13 +495,21 @@
struct thread *td;
if (*procptr == NULL) {
+ /*
+ * Use RFSTOPPED to ensure that *tdptr is initialized before the
+ * thread starts running.
+ */
error = kproc_create(func, arg,
- procptr, flags, pages, "%s", procname);
+ procptr, flags | RFSTOPPED, pages, "%s", procname);
if (error)
return (error);
td = FIRST_THREAD_IN_PROC(*procptr);
if (tdptr)
*tdptr = td;
+ if ((flags & RFSTOPPED) == 0) {
+ thread_lock(td);
+ sched_add(td, SRQ_BORING);
+ }
va_start(ap, fmt);
vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap);
va_end(ap);

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 3:20 PM (15 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15743705
Default Alt Text
D44927.diff (737 B)

Event Timeline