projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a3c5b4e
)
Merge new_thread() into thread_create().
author
Ben Pfaff
<blp@cs.stanford.edu>
Tue, 21 Sep 2004 01:14:50 +0000
(
01:14
+0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Tue, 21 Sep 2004 01:14:50 +0000
(
01:14
+0000)
src/threads/thread.c
patch
|
blob
|
history
diff --git
a/src/threads/thread.c
b/src/threads/thread.c
index 0861e29533b67a59e3b4a248311735deeb2b6d5b..336be0392804907a9c560d87c1256f500991a8bc 100644
(file)
--- a/
src/threads/thread.c
+++ b/
src/threads/thread.c
@@
-47,7
+47,6
@@
static void kernel_thread (thread_func *, void *aux);
static void idle (void *aux UNUSED);
static struct thread *running_thread (void);
static struct thread *next_thread_to_run (void);
static void idle (void *aux UNUSED);
static struct thread *running_thread (void);
static struct thread *next_thread_to_run (void);
-static struct thread *new_thread (const char *name, int priority);
static void init_thread (struct thread *, const char *name, int priority);
static bool is_thread (struct thread *);
static void *alloc_frame (struct thread *, size_t size);
static void init_thread (struct thread *, const char *name, int priority);
static bool is_thread (struct thread *);
static void *alloc_frame (struct thread *, size_t size);
@@
-116,10
+115,14
@@
thread_create (const char *name, int priority,
ASSERT (function != NULL);
ASSERT (function != NULL);
- t = new_thread (name, priority);
+ /* Allocate thread. */
+ t = palloc_get (PAL_ZERO);
if (t == NULL)
return TID_ERROR;
if (t == NULL)
return TID_ERROR;
- tid = t->tid;
+
+ /* Initialize thread. */
+ init_thread (t, name, priority);
+ tid = t->tid = allocate_tid ();
/* Stack frame for kernel_thread(). */
kf = alloc_frame (t, sizeof *kf);
/* Stack frame for kernel_thread(). */
kf = alloc_frame (t, sizeof *kf);
@@
-289,22
+292,6
@@
is_thread (struct thread *t)
return t != NULL && t->magic == THREAD_MAGIC;
}
return t != NULL && t->magic == THREAD_MAGIC;
}
-/* Creates a new thread named NAME as a child of the running
- thread. Returns the new thread if successful or a null
- pointer on failure. */
-static struct thread *
-new_thread (const char *name, int priority)
-{
- struct thread *t = palloc_get (PAL_ZERO);
- if (t != NULL)
- {
- init_thread (t, name, priority);
- t->tid = allocate_tid ();
- }
-
- return t;
-}
-
/* Does basic initialization of T as a blocked thread named
NAME. */
static void
/* Does basic initialization of T as a blocked thread named
NAME. */
static void