[riot-users] Sleep doesn't wake up by using multple threads

Andreas Zoor Andreas.b.Zoor at student.hs-rm.de
Mon Aug 31 14:19:05 CEST 2015


 

Hi,

I'm new at developing applications for riot and I'm trying to
run two threads in one application. When the threas call sleep they were
not woken up by the OS. I don't know why...

This is my code:

#include
<pthread.h>
#include <unistd.h>
#include <stdio.h>
#include
"vtimer.h"

int main(void);
void* thread_func(void* foo);

int
main(void){
 pthread_t t;

 pthread_create(&t, NULL, thread_func,
NULL);
 printf("Created new Threadn");

 for (;;){
 printf("Thread1:
Test :Dn");
 vtimer_usleep(10 *SEC_IN_USEC);
 }
}

void*
thread_func(void* foo){
 printf("Start new Threadn");
 for (;;){

printf("Thread2: Test :Dn");
 vtimer_usleep(10 *SEC_IN_USEC);
 }
}

And
the output is:

RIOT native interrupts/signals
initialized.
LED_GREEN_OFF
LED_RED_ON
RIOT native board
initialized.
RIOT native hardware initialization
complete.

kernel_init(): This is RIOT! (Version: UNKNOWN (builddir:
/home/andreas/workspace/portToRiot/platform/riot))
kernel_init():
jumping into first task...
Initilaized sDDS
Created new Thread
Thread1:
Test :D
Start new Thread
Thread2: Test :D

Can you help me?
 
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20150831/c77892b7/attachment.html>


More information about the users mailing list