Silly Pthread Issues
brycecr at gmail.com
brycecr at gmail.com
Sat Dec 10 08:50:02 CET 2011
Hi folks,
I'm trying to get some simple modules written just by modifying the
existing hello module. I've got a tiny stupid test one written, and I'm
getting undefined references for all of my pthread functions, even though
I've included all the necessary headers.
I'm modifying hello in place -- should I need to make any makefile
adjustments to get this to build?
Thank you very much!
The modified code is below:
#include <stdio.h>
#include <unistd.h>
#include <l4/util/rdtsc.h>
#include <pthread-l4.h>
#include <pthread.h>
void* pthread_func(void* none) {
pthread_yield();
return NULL;
}
int
main(void)
{
l4_cpu_time_t start_time = l4_rdtsc();
pthread_t t[100];
pthread_attr_t a[100];
for (int i = 0; i < 10; ++i) {
pthread_attr_init(&a[i]);
pthread_attr_setschedpolicy(&a[i], SCHED_L4);
pthread_attr_setinheritsched(&a[i],
PTHREAD_EXPLICIT_SCHED);
if (pthread_create(&t[i], &a[i], pthread_func, NULL))
puts("Everything");
}
printf("Cycles elapsed: ", l4_rdtsc() - start_time);
}
More information about the l4-hackers
mailing list