qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] using pthread on usermode, almost works.. but new thread bl


From: Henri Zikken
Subject: [Qemu-devel] using pthread on usermode, almost works.. but new thread blocks execution
Date: Wed, 22 Apr 2009 15:54:48 +0200

Though I know it's not recommended, I'm trying to use threads on qemu-ppc 
usermode. Unfortunatelly I have no other options.

Though I get no errors and the app does run, the created thread hogs the system.

I have tried setting a different scheduler, sigmask, and so on, but to no avail.

I'm using a Debian system, the target platform is powerpc-603. I use crosstools 
to compile.

This demo program shoud printout 'foo' and 'bar'.. but when run under qemu-ppc 
(usermode) it only keeps printing 'foo'.

Are there any options to fix this problem, or should I just accept that this 
isn't going to work?



#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <execinfo.h>
#include <signal.h>

void *start_routine(void *arg) 
{       int i;
        while (1==1) {
           printf("foo\n");
           i+1;
           sched_yield();          
        }       
}

int main(int argc, char *argv[]) 
{               
        pthread_t p_thread[1];  
        int cnt;
        int i;
        pthread_attr_t tattr;
    sigset_t *newset, *oldset;
        pthread_attr_init(&tattr);      
    sigfillset( newset );
    pthread_sigmask( SIG_BLOCK, newset, oldset );
        pthread_attr_setschedpolicy( &tattr, SCHED_RR );
        pthread_create( &p_thread[0], &tattr, start_routine, (void *)cnt );     
    
        
        
        while (1==1) {
           printf("bar\n");        
           i+1;
           sched_yield();          
        }
}


Best regards,
 
Henri Zikken







reply via email to

[Prev in Thread] Current Thread [Next in Thread]