This code seems to have some issues. Please check.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1971 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2002-11-17 00:52:43 +00:00
parent eb8218b543
commit b795251564
3 changed files with 13 additions and 12 deletions
+8 -8
View File
@@ -95,17 +95,17 @@ install_interrupt_handler(long vector, interrupt_handler handler, void *data)
io->func = handler;
io->data = data;
/* Make sure our list is init'd or bad things will happen */
if (io_vectors[vector].handler_list.next == NULL) {
io_vectors[vector].handler_list.next = &io_vectors[vector].handler_list;
io_vectors[vector].handler_list.prev = &io_vectors[vector].handler_list;
}
/* Disable the interrupts, get the spinlock for this irq only
* and then insert the handler */
state = disable_interrupts();
acquire_spinlock(&io_vectors[vector].vector_lock);
/* Make sure our list is init'd or bad things will happen */ //XXX this should not be needed
if (io_vectors[vector].handler_list.next == NULL) {
io_vectors[vector].handler_list.next = &io_vectors[vector].handler_list;
io_vectors[vector].handler_list.prev = &io_vectors[vector].handler_list;
}
insque(io, &io_vectors[vector].handler_list);
release_spinlock(&io_vectors[vector].vector_lock);
@@ -165,7 +165,7 @@ remove_interrupt_handler(long vector, interrupt_handler handler, void *data)
/* we have to match both function and data */
if (io->func == handler && io->data == data) {
remque(io);
free(io);
free(io); // XXX free() should not be called inside a spinlock or with disabled interrupts
rv = 0;
break;
}
@@ -237,7 +237,7 @@ int_io_interrupt_handler(int vector)
* right.
*/
for (io = io_vectors[vector].handler_list.next;
io != &io_vectors[vector].handler_list;
io != &io_vectors[vector].handler_list; //XXX DOES this work for 1 entry?
io = io->next) {
if ((ret = io->func(io->data)) != B_UNHANDLED_INTERRUPT)
break;
+2 -2
View File
@@ -48,7 +48,7 @@ dump_run_q(int argc, char **argv)
void
thread_enqueue_run_q(struct thread *t)
thread_enqueue_run_q(struct thread *t) //XXX no locks? is this save?
{
struct thread *curr, *prev;
@@ -93,7 +93,7 @@ thread_set_priority(thread_id id, int32 priority)
if (t->id == id) {
// it's ourself, so we know we aren't in the run queue, and we can manipulate
// our structure directly
retval = t->priority;
retval = t->priority; //XXX is this really save? can't we get preempted right here?
t->priority = priority;
} else {
int state = disable_interrupts();
+3 -2
View File
@@ -169,7 +169,7 @@ send_signal_etc(pid_t tid, uint sig, uint32 flags)
}
if (!(flags & B_DO_NOT_RESCHEDULE))
resched();
resched(); //XXX really here, while interrupts are disabled?
RELEASE_THREAD_LOCK();
restore_interrupts(state);
@@ -264,7 +264,8 @@ sys_set_alarm(bigtime_t time, uint32 mode)
int state;
bigtime_t rv = 0;
state = disable_interrupts();
state = disable_interrupts(); //XXX really here? and what about a spinlock?
if (t->alarm.period)
rv = (bigtime_t)t->alarm.entry.key - system_time();