Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206203
b: refs/heads/master
c: 82805ab
h: refs/heads/master
i:
  206201: 6f25efd
  206199: 405331d
v: v3
  • Loading branch information
Tejun Heo committed Jun 29, 2010
1 parent 1fd5246 commit 3e90c68
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7bc465605ffa90b281d6b774fcb13911636a6d45
refs/heads/master: 82805ab77d25643f579d90397dcd34f05d1b750a
1 change: 1 addition & 0 deletions trunk/include/linux/kthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
void kthread_bind(struct task_struct *k, unsigned int cpu);
int kthread_stop(struct task_struct *k);
int kthread_should_stop(void);
void *kthread_data(struct task_struct *k);

int kthreadd(void *unused);
extern struct task_struct *kthreadd_task;
Expand Down
15 changes: 15 additions & 0 deletions trunk/kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct kthread_create_info

struct kthread {
int should_stop;
void *data;
struct completion exited;
};

Expand All @@ -56,6 +57,19 @@ int kthread_should_stop(void)
}
EXPORT_SYMBOL(kthread_should_stop);

/**
* kthread_data - return data value specified on kthread creation
* @task: kthread task in question
*
* Return the data value specified when kthread @task was created.
* The caller is responsible for ensuring the validity of @task when
* calling this function.
*/
void *kthread_data(struct task_struct *task)
{
return to_kthread(task)->data;
}

static int kthread(void *_create)
{
/* Copy data: it's on kthread's stack */
Expand All @@ -66,6 +80,7 @@ static int kthread(void *_create)
int ret;

self.should_stop = 0;
self.data = data;
init_completion(&self.exited);
current->vfork_done = &self.exited;

Expand Down

0 comments on commit 3e90c68

Please sign in to comment.