Replaced no longer necessary send_signal_etc() work-arounds for
resume_thread(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36531 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
28d05e026f
commit
d3166e469c
@ -12,7 +12,6 @@
|
||||
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -60,7 +59,7 @@ dpc_thread(void *arg)
|
||||
|
||||
release_spinlock(&queue->lock);
|
||||
restore_interrupts(former);
|
||||
|
||||
|
||||
dpc.function(dpc.arg);
|
||||
}
|
||||
|
||||
@ -69,7 +68,7 @@ dpc_thread(void *arg)
|
||||
while (queue->count--) {
|
||||
dpc = queue->slots[queue->head];
|
||||
queue->head = (queue->head++) % queue->size;
|
||||
dpc.function(dpc.arg);
|
||||
dpc.function(dpc.arg);
|
||||
}
|
||||
|
||||
// Now, let's die quietly, ignored by all... sigh.
|
||||
@ -85,20 +84,20 @@ new_dpc_queue(void **handle, const char *name, int32 priority)
|
||||
{
|
||||
char str[64];
|
||||
dpc_queue *queue;
|
||||
|
||||
|
||||
if (!handle)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
queue = malloc(sizeof(dpc_queue) + DPC_QUEUE_SIZE * sizeof(dpc_slot));
|
||||
if (!queue)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
|
||||
queue->head = queue->tail = 0;
|
||||
queue->size = DPC_QUEUE_SIZE;
|
||||
queue->count = 0;
|
||||
B_INITIALIZE_SPINLOCK(&queue->lock); // Init the spinlock
|
||||
|
||||
snprintf(str, sizeof(str), "%.*s_wakeup_sem",
|
||||
snprintf(str, sizeof(str), "%.*s_wakeup_sem",
|
||||
(int) sizeof(str) - 11, name);
|
||||
|
||||
queue->wakeup_sem = create_sem(0, str);
|
||||
@ -107,7 +106,7 @@ new_dpc_queue(void **handle, const char *name, int32 priority)
|
||||
free(queue);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
// Fire a kernel thread to actually handle (aka call them!)
|
||||
// the queued/deferred procedure calls
|
||||
queue->thread = spawn_kernel_thread(dpc_thread, name, priority, queue);
|
||||
@ -117,7 +116,7 @@ new_dpc_queue(void **handle, const char *name, int32 priority)
|
||||
free(queue);
|
||||
return status;
|
||||
}
|
||||
send_signal_etc(queue->thread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(queue->thread);
|
||||
|
||||
*handle = queue;
|
||||
|
||||
@ -139,10 +138,10 @@ delete_dpc_queue(void *handle)
|
||||
// Close the queue: queue_dpc() should knows we're closing:
|
||||
former = disable_interrupts();
|
||||
acquire_spinlock(&queue->lock);
|
||||
|
||||
|
||||
thread = queue->thread;
|
||||
queue->thread = -1;
|
||||
|
||||
|
||||
release_spinlock(&queue->lock);
|
||||
restore_interrupts(former);
|
||||
|
||||
@ -151,7 +150,7 @@ delete_dpc_queue(void *handle)
|
||||
wait_for_thread(thread, &exit_value);
|
||||
|
||||
free(queue);
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -162,14 +161,14 @@ queue_dpc(void *handle, dpc_func function, void *arg)
|
||||
dpc_queue *queue = handle;
|
||||
cpu_status former;
|
||||
status_t status = B_OK;
|
||||
|
||||
|
||||
if (!queue || !function)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// Try to be safe being called from interrupt handlers:
|
||||
former = disable_interrupts();
|
||||
acquire_spinlock(&queue->lock);
|
||||
|
||||
|
||||
if (queue->thread < 0) {
|
||||
// Queue thread is dying...
|
||||
status = B_CANCELED;
|
||||
@ -180,7 +179,7 @@ queue_dpc(void *handle, dpc_func function, void *arg)
|
||||
queue->slots[queue->tail].function = function;
|
||||
queue->slots[queue->tail].arg = arg;
|
||||
queue->tail = (queue->tail++) % queue->size;
|
||||
queue->count++;
|
||||
queue->count++;
|
||||
}
|
||||
|
||||
release_spinlock(&queue->lock);
|
||||
@ -191,7 +190,7 @@ queue_dpc(void *handle, dpc_func function, void *arg)
|
||||
// Notice that interrupt handlers should returns B_INVOKE_SCHEDULER to
|
||||
// shorten DPC latency as much as possible...
|
||||
status = release_sem_etc(queue->wakeup_sem, 1, B_DO_NOT_RESCHEDULE);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -217,7 +216,7 @@ static dpc_module_info sDPCModule = {
|
||||
0,
|
||||
std_ops
|
||||
},
|
||||
|
||||
|
||||
new_dpc_queue,
|
||||
delete_dpc_queue,
|
||||
queue_dpc
|
||||
|
3
src/system/kernel/cache/block_cache.cpp
vendored
3
src/system/kernel/cache/block_cache.cpp
vendored
@ -7,7 +7,6 @@
|
||||
#include <block_cache.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@ -2602,7 +2601,7 @@ block_cache_init(void)
|
||||
sNotifierWriterThread = spawn_kernel_thread(&block_notifier_and_writer,
|
||||
"block notifier/writer", B_LOW_PRIORITY, NULL);
|
||||
if (sNotifierWriterThread >= B_OK)
|
||||
send_signal_etc(sNotifierWriterThread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(sNotifierWriterThread);
|
||||
|
||||
#if DEBUG_BLOCK_CACHE
|
||||
add_debugger_command_etc("block_caches", &dump_caches,
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <int.h>
|
||||
#include <kernel.h>
|
||||
#include <lock.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <team.h>
|
||||
#include <thread.h>
|
||||
@ -2176,7 +2175,7 @@ heap_init_post_thread()
|
||||
|
||||
dprintf("heap_init_post_thread(): created VIP heap: %p\n", sVIPHeap);
|
||||
|
||||
send_signal_etc(sHeapGrowThread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(sHeapGrowThread);
|
||||
|
||||
#endif // !USE_SLAB_ALLOCATOR_FOR_MALLOC
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <kernel_daemon.h>
|
||||
|
||||
#include <new>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <KernelExport.h>
|
||||
@ -75,7 +74,7 @@ KernelDaemon::Init(const char* name)
|
||||
if (fThread < 0)
|
||||
return fThread;
|
||||
|
||||
send_signal_etc(fThread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(fThread);
|
||||
fUnregisterCondition.Init(this, name);
|
||||
|
||||
return B_OK;
|
||||
@ -144,7 +143,7 @@ KernelDaemon::Unregister(daemon_hook function, void* arg)
|
||||
locker.Unlock();
|
||||
|
||||
entry.Wait();
|
||||
|
||||
|
||||
locker.Lock();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <low_resource_manager.h>
|
||||
|
||||
#include <new>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -364,7 +363,7 @@ low_resource_manager_init_post_thread(void)
|
||||
|
||||
thread_id thread = spawn_kernel_thread(&low_resource_manager,
|
||||
"low resource manager", B_LOW_PRIORITY, NULL);
|
||||
send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(thread);
|
||||
|
||||
add_debugger_command("low_resource", &dump_handlers,
|
||||
"Dump list of low resource handlers");
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <new>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -809,5 +808,5 @@ slab_init_post_thread()
|
||||
return;
|
||||
}
|
||||
|
||||
send_signal_etc(objectCacheResizer, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(objectCacheResizer);
|
||||
}
|
||||
|
@ -2162,7 +2162,7 @@ thread_init(kernel_args *args)
|
||||
B_DISPLAY_PRIORITY, NULL);
|
||||
if (undertakerThread < 0)
|
||||
panic("Failed to create undertaker thread!");
|
||||
send_signal_etc(undertakerThread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(undertakerThread);
|
||||
|
||||
// set up some debugger commands
|
||||
add_debugger_command_etc("threads", &dump_thread_list, "List all threads",
|
||||
|
@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -2955,7 +2954,7 @@ vm_page_init_post_thread(kernel_args *args)
|
||||
|
||||
thread_id thread = spawn_kernel_thread(&page_scrubber, "page scrubber",
|
||||
B_LOWEST_ACTIVE_PRIORITY, NULL);
|
||||
send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(thread);
|
||||
|
||||
// start page writer
|
||||
|
||||
@ -2963,7 +2962,7 @@ vm_page_init_post_thread(kernel_args *args)
|
||||
|
||||
thread = spawn_kernel_thread(&page_writer, "page writer",
|
||||
B_NORMAL_PRIORITY + 1, NULL);
|
||||
send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(thread);
|
||||
|
||||
// start page daemon
|
||||
|
||||
@ -2971,7 +2970,7 @@ vm_page_init_post_thread(kernel_args *args)
|
||||
|
||||
thread = spawn_kernel_thread(&page_daemon, "page daemon",
|
||||
B_NORMAL_PRIORITY, NULL);
|
||||
send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE);
|
||||
resume_thread(thread);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user