This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
POSIX thread problem
- From: Kaushik karandikar <kaushikkarandikar at yahoo dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Sun, 25 Sep 2005 23:51:08 -0700 (PDT)
- Subject: [ECOS] POSIX thread problem
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;
// 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,
Kaushik
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss