Replaced the standard thread functions with a BeOS compatible set.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2573 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
51cc35a759
commit
c333b5aa8e
@ -46,7 +46,7 @@ bool kernel_startup;
|
||||
|
||||
static kernel_args ka;
|
||||
|
||||
static int main2(void *);
|
||||
static int32 main2(void *);
|
||||
|
||||
int _start(kernel_args *oldka, int cpu); /* keep compiler happy */
|
||||
|
||||
@ -109,9 +109,8 @@ _start(kernel_args *oldka, int cpu_num)
|
||||
|
||||
// start a thread to finish initializing the rest of the system
|
||||
{
|
||||
thread_id tid;
|
||||
tid = thread_create_kernel_thread("main2", &main2, NULL);
|
||||
thread_resume_thread(tid);
|
||||
thread_id thread = spawn_kernel_thread(&main2, "main2", B_NORMAL_PRIORITY, NULL);
|
||||
resume_thread(thread);
|
||||
}
|
||||
|
||||
smp_wake_up_all_non_boot_cpus();
|
||||
@ -135,7 +134,7 @@ _start(kernel_args *oldka, int cpu_num)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int32
|
||||
main2(void *unused)
|
||||
{
|
||||
(void)(unused);
|
||||
|
@ -942,10 +942,13 @@ delete_owned_ports(team_id owner)
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* testcode
|
||||
*/
|
||||
|
||||
static int32 port_test_thread_func(void *arg);
|
||||
|
||||
port_id test_p1, test_p2, test_p3, test_p4;
|
||||
|
||||
void
|
||||
@ -985,10 +988,9 @@ port_test()
|
||||
dprintf("porttest: res=%d, %s\n", res, res == B_TIMED_OUT ? "ok" : "BAD");
|
||||
|
||||
dprintf("porttest: spawning thread for port 1\n");
|
||||
t = thread_create_kernel_thread("port_test", port_test_thread_func, NULL);
|
||||
// resume thread
|
||||
thread_resume_thread(t);
|
||||
|
||||
t = spawn_kernel_thread(port_test_thread_func, "port_test", B_NORMAL_PRIORITY, NULL);
|
||||
resume_thread(t);
|
||||
|
||||
dprintf("porttest: write\n");
|
||||
write_port(test_p1, 1, &testdata, sizeof(testdata));
|
||||
|
||||
@ -1015,8 +1017,8 @@ port_test()
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
port_test_thread_func(void* arg)
|
||||
static int32
|
||||
port_test_thread_func(void *arg)
|
||||
{
|
||||
int32 msg_code;
|
||||
int n;
|
||||
@ -1039,6 +1041,7 @@ port_test_thread_func(void* arg)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
@ -1046,6 +1049,7 @@ port_test_thread_func(void* arg)
|
||||
* user level ports
|
||||
*/
|
||||
|
||||
|
||||
port_id
|
||||
user_create_port(int32 queue_length, const char *uname)
|
||||
{
|
||||
|
@ -1668,7 +1668,7 @@ vm_aspace_walk_next(struct hash_iterator *i)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int32
|
||||
vm_thread_dump_max_commit(void *unused)
|
||||
{
|
||||
int oldmax = -1;
|
||||
@ -1817,13 +1817,15 @@ int vm_init_postsem(kernel_args *ka)
|
||||
return heap_init_postsem(ka);
|
||||
}
|
||||
|
||||
int vm_init_postthread(kernel_args *ka)
|
||||
|
||||
int
|
||||
vm_init_postthread(kernel_args *ka)
|
||||
{
|
||||
vm_page_init_postthread(ka);
|
||||
|
||||
{
|
||||
thread_id tid = thread_create_kernel_thread("max_commit_thread", &vm_thread_dump_max_commit, NULL);
|
||||
thread_resume_thread(tid);
|
||||
thread_id thread = spawn_kernel_thread(&vm_thread_dump_max_commit, "max_commit_thread", B_NORMAL_PRIORITY, NULL);
|
||||
resume_thread(thread);
|
||||
}
|
||||
|
||||
vm_daemon_init();
|
||||
|
@ -122,7 +122,8 @@ static void scan_pages(vm_address_space *aspace, addr free_target)
|
||||
// dprintf("exiting scan_pages\n");
|
||||
}
|
||||
|
||||
static int page_daemon()
|
||||
static int32
|
||||
page_daemon(void *unused)
|
||||
{
|
||||
struct hash_iterator i;
|
||||
vm_address_space *old_aspace;
|
||||
@ -133,6 +134,7 @@ static int page_daemon()
|
||||
bigtime_t now;
|
||||
|
||||
dprintf("page daemon starting\n");
|
||||
(void)unused;
|
||||
|
||||
for(;;) {
|
||||
snooze(PAGE_DAEMON_INTERVAL);
|
||||
@ -189,9 +191,11 @@ static int page_daemon()
|
||||
}
|
||||
}
|
||||
|
||||
int vm_daemon_init()
|
||||
|
||||
int
|
||||
vm_daemon_init()
|
||||
{
|
||||
thread_id tid;
|
||||
thread_id thread;
|
||||
|
||||
trimming_cycle = false;
|
||||
|
||||
@ -200,9 +204,8 @@ int vm_daemon_init()
|
||||
free_memory_high_water = vm_page_num_pages() / 4;
|
||||
|
||||
// create a kernel thread to select pages for pageout
|
||||
tid = thread_create_kernel_thread("page daemon", &page_daemon, NULL);
|
||||
thread_set_priority(tid, B_FIRST_REAL_TIME_PRIORITY);
|
||||
thread_resume_thread(tid);
|
||||
thread = spawn_kernel_thread(&page_daemon, "page daemon", B_FIRST_REAL_TIME_PRIORITY, NULL);
|
||||
resume_thread(thread);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ static int dump_page_stats(int argc, char **argv);
|
||||
static int dump_free_page_table(int argc, char **argv);
|
||||
static int vm_page_set_state_nolock(vm_page *page, int page_state);
|
||||
static void clear_page(addr pa);
|
||||
static int page_scrubber(void *);
|
||||
static int32 page_scrubber(void *);
|
||||
|
||||
|
||||
static vm_page *dequeue_page(page_queue *q)
|
||||
@ -254,7 +254,9 @@ int vm_page_init(kernel_args *ka)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vm_page_init2(kernel_args *ka)
|
||||
|
||||
int
|
||||
vm_page_init2(kernel_args *ka)
|
||||
{
|
||||
void *null;
|
||||
|
||||
@ -270,14 +272,15 @@ int vm_page_init2(kernel_args *ka)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vm_page_init_postthread(kernel_args *ka)
|
||||
|
||||
int
|
||||
vm_page_init_postthread(kernel_args *ka)
|
||||
{
|
||||
thread_id tid;
|
||||
thread_id thread;
|
||||
|
||||
// create a kernel thread to clear out pages
|
||||
tid = thread_create_kernel_thread("page scrubber", &page_scrubber, NULL);
|
||||
thread_set_priority(tid, B_LOWEST_ACTIVE_PRIORITY);
|
||||
thread_resume_thread(tid);
|
||||
thread = spawn_kernel_thread(&page_scrubber, "page scrubber", B_LOWEST_ACTIVE_PRIORITY, NULL);
|
||||
resume_thread(thread);
|
||||
|
||||
modified_pages_available = create_sem(0, "modified_pages_avail_sem");
|
||||
#if 0
|
||||
@ -288,7 +291,9 @@ int vm_page_init_postthread(kernel_args *ka)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int page_scrubber(void *unused)
|
||||
|
||||
static int32
|
||||
page_scrubber(void *unused)
|
||||
{
|
||||
#define SCRUB_SIZE 16
|
||||
int state;
|
||||
@ -300,16 +305,16 @@ static int page_scrubber(void *unused)
|
||||
|
||||
dprintf("page_scrubber starting...\n");
|
||||
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
snooze(100000); // 100ms
|
||||
|
||||
if(page_free_queue.count > 0) {
|
||||
if (page_free_queue.count > 0) {
|
||||
state = disable_interrupts();
|
||||
acquire_spinlock(&page_lock);
|
||||
|
||||
for(i=0; i<SCRUB_SIZE; i++) {
|
||||
for (i = 0; i < SCRUB_SIZE; i++) {
|
||||
page[i] = dequeue_page(&page_free_queue);
|
||||
if(page[i] == NULL)
|
||||
if (page[i] == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user