some more small fixes
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1805 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -769,8 +769,6 @@ sem_interrupt_thread(struct thread *t)
|
|||||||
if (!(t->sem_flags & B_CAN_INTERRUPT))
|
if (!(t->sem_flags & B_CAN_INTERRUPT))
|
||||||
return ERR_SEM_NOT_INTERRUPTABLE;
|
return ERR_SEM_NOT_INTERRUPTABLE;
|
||||||
|
|
||||||
// t->next_state = B_THREAD_READY;
|
|
||||||
|
|
||||||
slot = t->sem_blocking % MAX_SEMS;
|
slot = t->sem_blocking % MAX_SEMS;
|
||||||
|
|
||||||
GRAB_SEM_LOCK(gSems[slot]);
|
GRAB_SEM_LOCK(gSems[slot]);
|
||||||
@@ -819,7 +817,7 @@ remove_thread_from_sem(struct thread *t, struct sem_entry *sem, struct thread_qu
|
|||||||
t->sem_count -= delta;
|
t->sem_count -= delta;
|
||||||
if (t->sem_count <= 0) {
|
if (t->sem_count <= 0) {
|
||||||
t = thread_dequeue(&sem->q);
|
t = thread_dequeue(&sem->q);
|
||||||
t->state = B_THREAD_READY;
|
t->state = t->next_state = B_THREAD_READY;
|
||||||
thread_enqueue(t, queue);
|
thread_enqueue(t, queue);
|
||||||
}
|
}
|
||||||
sem->count -= delta;
|
sem->count -= delta;
|
||||||
|
|||||||
@@ -515,7 +515,6 @@ dump_thread_info(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct thread *t;
|
struct thread *t;
|
||||||
int id = -1;
|
int id = -1;
|
||||||
unsigned long num;
|
|
||||||
struct hash_iterator i;
|
struct hash_iterator i;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
@@ -524,16 +523,10 @@ dump_thread_info(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the argument looks like a hex number, treat it as such
|
// if the argument looks like a hex number, treat it as such
|
||||||
if (strlen(argv[1]) > 2 && argv[1][0] == '0' && argv[1][1] == 'x') {
|
if (strlen(argv[1]) > 2 && argv[1][0] == '0' && argv[1][1] == 'x')
|
||||||
num = atoul(argv[1]);
|
id = strtoul(argv[1], NULL, 16);
|
||||||
/* if(num > vm_get_kernel_aspace()->virtual_map.base) {
|
else
|
||||||
// XXX semi-hack
|
id = atoi(argv[1]);
|
||||||
_dump_thread_info((struct thread *)num);
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
*/
|
|
||||||
id = num;
|
|
||||||
}
|
|
||||||
|
|
||||||
// walk through the thread list, trying to match name or id
|
// walk through the thread list, trying to match name or id
|
||||||
hash_open(thread_hash, &i);
|
hash_open(thread_hash, &i);
|
||||||
@@ -1076,14 +1069,10 @@ thread_wait_on_thread(thread_id id, int *retcode)
|
|||||||
rc = B_NO_ERROR;
|
rc = B_NO_ERROR;
|
||||||
|
|
||||||
if (retcode) {
|
if (retcode) {
|
||||||
state = disable_interrupts();
|
|
||||||
GRAB_THREAD_LOCK();
|
|
||||||
t = thread_get_current_thread();
|
t = thread_get_current_thread();
|
||||||
dprintf("thread_wait_on_thread: thread %ld got return code 0x%x\n",
|
dprintf("thread_wait_on_thread: thread %ld got return code 0x%x\n",
|
||||||
t->id, t->sem_deleted_retcode);
|
t->id, t->sem_deleted_retcode);
|
||||||
*retcode = t->sem_deleted_retcode;
|
*retcode = t->sem_deleted_retcode;
|
||||||
RELEASE_THREAD_LOCK();
|
|
||||||
restore_interrupts(state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1521,9 +1510,11 @@ user_thread_wait_on_thread(thread_id id, int *uretcode)
|
|||||||
|
|
||||||
rc = thread_wait_on_thread(id, &retcode);
|
rc = thread_wait_on_thread(id, &retcode);
|
||||||
|
|
||||||
|
if (uretcode) {
|
||||||
rc2 = user_memcpy(uretcode, &retcode, sizeof(int));
|
rc2 = user_memcpy(uretcode, &retcode, sizeof(int));
|
||||||
if (rc2 < 0)
|
if (rc2 < 0)
|
||||||
return rc2;
|
return rc2;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user