Removed THREAD_WAIT call completely.

Simply reverse this patch to add THREAD_WAIT
This commit is contained in:
Bahadir Balban
2009-10-31 17:12:03 +02:00
parent dd5e05380c
commit 09197d1fb1
7 changed files with 11 additions and 64 deletions

View File

@@ -33,7 +33,8 @@ int exit_test(void)
} else
printf("Thread (%d) created successfully.\n", ids.tid);
#if 0
// l4_thread_switch(0);
/* Kill it */
printf("Killing Thread (%d).\n", ids.tid);
if ((ret = l4_thread_control(THREAD_DESTROY, &ids)) < 0)
@@ -41,10 +42,9 @@ int exit_test(void)
else
printf("Success: Killed Thread (%d)\n", ids.tid);
#endif
l4_thread_switch(0);
#if 0
/* Wait on it */
printf("Waiting on Thread (%d) to exit.\n", ids.tid);
if ((ret = l4_thread_control(THREAD_WAIT, &ids)) >= 0)
@@ -53,6 +53,7 @@ int exit_test(void)
printf("Error. Wait on (%d) failed. err = %d\n",
ids.tid, ret);
return 0;
#endif
out_err:
BUG();

View File

@@ -58,7 +58,7 @@ int wait_check_test(struct task_ids *ids)
int result;
/* Wait for thread to finish */
result = l4_thread_control(THREAD_WAIT, ids);
//result = l4_thread_control(THREAD_WAIT, ids);
if (result < 0) {
printf("Waiting on (%d)'s exit failed.\n", ids->tid);
return -1;

View File

@@ -7,7 +7,6 @@
#define THREAD_SUSPEND 0x0002
#define THREAD_DESTROY 0x0003
#define THREAD_RECYCLE 0x0004
#define THREAD_WAIT 0x0005
#define THREAD_CREATE_MASK 0x0FF0
#define TC_SHARE_CAPS 0x0010 /* Share all thread capabilities */

View File

@@ -50,7 +50,6 @@
#define CAP_TCTRL_RUN (1 << 2)
#define CAP_TCTRL_SUSPEND (1 << 3)
#define CAP_TCTRL_RECYCLE (1 << 4)
#define CAP_TCTRL_WAIT (1 << 5)
/* Exchange registers capability */
#define CAP_EXREGS_RW_PAGER (1 << 0)

View File

@@ -110,7 +110,7 @@ cap_all_others = \
\t\t\t\t.type = CAP_TYPE_TCTRL | CAP_RTYPE_CONTAINER,
\t\t\t\t.access = CAP_TCTRL_CREATE | CAP_TCTRL_DESTROY
\t\t\t\t | CAP_TCTRL_SUSPEND | CAP_TCTRL_RUN
\t\t\t\t | CAP_TCTRL_RECYCLE | CAP_TCTRL_WAIT,
\t\t\t\t | CAP_TCTRL_RECYCLE,
\t\t\t\t.start = 0, .end = 0, .size = 0,
\t\t\t},
\t\t\t[%d] = {

View File

@@ -49,48 +49,6 @@ int thread_signal_sync(struct ktcb *task, unsigned int flags,
return ret;
}
int thread_wait(struct task_ids *ids)
{
struct ktcb *task, *n;
int ret;
if (!(task = tcb_find(ids->tid))) {
/* Retry in own queue till we find it */
retry:
spin_lock(&current->child_exit_list.list_lock);
list_foreach_removable_struct(task, n,
&current->child_exit_list.list,
task_list) {
if (task->tid == ids->tid) {
printk("%s: Found (%d) in exit queue.\n",
__FUNCTION__, task->tid);
list_remove(&task->task_list);
tcb_delete(task);
spin_unlock(&current->child_exit_list.list_lock);
return 0;
}
}
spin_unlock(&current->child_exit_list.list_lock);
schedule();
goto retry;
}
printk("%s: Found (%d) in global queue.\n",
__FUNCTION__, task->tid);
/* Got a handle on the task, wait on it conditionally */
WAIT_EVENT(&task->wqh_pager,
task->state == TASK_INACTIVE, ret);
/*
* We found it in global queue but
* now it must be in exit queue
*/
ktcb_list_remove(task, &current->child_exit_list);
tcb_delete(task);
return 0;
}
int thread_suspend(struct ktcb *task)
{
return thread_signal_sync(task, TASK_SUSPENDING, TASK_INACTIVE);
@@ -183,6 +141,7 @@ int thread_destroy(struct ktcb *task)
/* Delete all exited children */
spin_lock(&current->child_exit_list.list_lock);
printk("(%d) To delete %d children\n", current->tid, current->child_exit_list.count);
list_foreach_removable_struct(child, n,
&current->child_exit_list.list,
task_list) {
@@ -415,8 +374,7 @@ int sys_thread_control(unsigned int flags, struct task_ids *ids)
MAP_USR_RW_FLAGS, 1)) < 0)
return err;
if ((flags & THREAD_ACTION_MASK) != THREAD_CREATE &&
(flags & THREAD_ACTION_MASK) != THREAD_WAIT)
if ((flags & THREAD_ACTION_MASK) != THREAD_CREATE)
if (!(task = tcb_find(ids->tid)))
return -ESRCH;
@@ -439,9 +397,6 @@ int sys_thread_control(unsigned int flags, struct task_ids *ids)
case THREAD_RECYCLE:
ret = thread_recycle(task);
break;
case THREAD_WAIT:
ret = thread_wait(ids);
break;
default:
ret = -EINVAL;

View File

@@ -437,23 +437,16 @@ struct capability *cap_match_thread(struct capability *cap,
if (!(cap->access & CAP_TCTRL_RECYCLE))
return 0;
break;
case THREAD_WAIT:
if (!(cap->access & CAP_TCTRL_WAIT))
return 0;
break;
default:
/* We refuse to accept anything else */
return 0;
}
/* If no target and create, or vice versa, it really is a bug */
BUG_ON(!target && (action_flags != THREAD_CREATE &&
action_flags != THREAD_WAIT));
BUG_ON(target && (action_flags == THREAD_CREATE ||
action_flags == THREAD_WAIT));
BUG_ON(!target && action_flags != THREAD_CREATE);
BUG_ON(target && action_flags == THREAD_CREATE);
if (action_flags == THREAD_CREATE ||
action_flags == THREAD_WAIT) {
if (action_flags == THREAD_CREATE) {
/*
* FIXME: Add cid to task_ids arg.
*