[ECOS] POSIX thread problem
sz111
sz111@126.com
Tue Nov 27 09:58:00 GMT 2007
Hi All,
I want to create a new thread using
pthread_create() function. I have added the package
POSIX compatibility. But i am not getting the prints
in the thread function.
My code snippet :
#include <cyg/kernel/kapi.h>
#include<cyg/posix/semaphore.h>
#include<cyg/posix/pthread.h>
#include<cyg/posix/types.h>
void *thread_func(void *arg)
{
while(1)
{
cyg_thread_delay(5);
diag_printf("\n\nIn thread Function....\n\n");
}
}
void cyg_start()
{
int res;
pthread_t a_thread;
void *thread_result;
// pthread_attr_t attr;POSIX thread problem
// attr.stacksize = 4096;
// attr.detachstate=PTHREAD_CREATE_JOINABLE;
// attr.schedpolicy=SCHED_RR;
// attr.inheritsched=PTHREAD_INHERIT_SCHED;
// pthread_attr_init(&attr);
// res =
pthread_create(&a_thread,&attr,thread_func,NULL);
res =
pthread_create(&a_thread,NULL,thread_func,NULL);
if(res != 0)
{
diag_printf("\nThread Creation failed....\n");
}
diag_printf("\ncalling thread_func....\n");
cyg_scheduler_start();
}
Is there any othe package that need to be added in the
eCOS to make work the POSIX compliant thread and
semaphire calls?
I am new to the eCOS. Please help me to solve this
problem.
Thanks and Regards,
creator
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list