Hi Pablo,
U can use same attribute object to create as many threads as u wish. Once u call pthread_create function all attribute fields are copied into thread structure. U can see it in __pthread_create function in schedulers/rtl_sched.c file. Regards Venkat --- Pablo Alvarez <[EMAIL PROTECTED]> wrote: > Hi Ravi, > > I think you should not use the same attribute object > for both threads, > especially since they are supposed to have different > priorities. Do you get > the kernel panic if you use two separate attribute > objects? > > Pablo Alvarez > > At 12:02 PM 3/27/2002 +0530, you wrote: > >Hello, > > > >I am facing a problem while creating more than one > rt-threads in my program. > >On some machines it is consistantly giving kernel > panic result. Some other > >machines it does not give any problem and my > program works fine. > > > >I would like to know whethere there is any > limitation in creating more than > >one RT-Threads in a single process. If anyone out > there has any idea, can > >you please let me know where I am doing wrong? > > > >Both the machines have rtl-3.1 and kernel version > 2.4.4. > > > >Here I am attaching the small sample program I have > written. I have modified > >the same hello.c in the examples that come along > with the rt-linux > >installation and am using the same Makefile for > creating the module and > >inserting it. > > > >Thanks much in advance for your help. > > > >Regards, > >Ravi > > > >/* === > >hello.c > >====*/ > > > > > >#include <rtl.h> > >#include <time.h> > >#include <pthread.h> > >#include <linux/malloc.h> > > > >pthread_t thread; > >pthread_t thread1; > >pthread_attr_t attr; > >struct sched_param schedParam; > > > >char *name = NULL; > > > >void * start_routine(void *arg) > >{ > > int cnt = 0; > > > > pthread_make_periodic_np (pthread_self(), > gethrtime(), 500000000); > > > > while (1) { > > pthread_wait_np (); > > if(cnt %10 == 0) > > { > > cnt = 0; > > rtl_printf("I'm here; my > arg is %x\n", (unsigned) > >arg); > > } > > cnt++; > > } > > return 0; > >} > >void * start_routine1(void *arg) > >{ > > int cnt = 0; > > char *name = "Test program"; > > > > pthread_make_periodic_np (pthread_self(), > gethrtime(), 500000000); > > > > while (1) { > > pthread_wait_np (); > > if(cnt % 20 == 0) > > { > > rtl_printf("in thread 2 > \n"); > > rtl_printf("my arg is > %x\n", (unsigned) arg); > > if(name != NULL) > > rtl_printf(" Name > = %s \n", name); > > cnt = 0; > > } > > cnt++; > > } > > return 0; > >} > > > >int init_module(void) { > > int ret = 0; > > pthread_attr_init(&attr); > > schedParam.sched_priority = 2; > > pthread_attr_setschedparam(&attr, > &schedParam); > > ret = pthread_create (&thread, &attr, > start_routine, 0); > > > > pthread_attr_init(&attr); > > schedParam.sched_priority = 1; > > pthread_attr_setschedparam(&attr, > &schedParam); > > ret = pthread_create (&thread1, &attr, > start_routine1, 0); > > return ret; > >} > > > >void cleanup_module(void) { > > pthread_delete_np (thread); > > pthread_delete_np (thread1); > >} > > > >/* ================ > >end of the hello.c program > >================== */ > >-- [rtl] --- > >To unsubscribe: > >echo "unsubscribe rtl" | mail [EMAIL PROTECTED] > OR > >echo "unsubscribe rtl <Your_email>" | mail > [EMAIL PROTECTED] > >-- > >For more information on Real-Time Linux see: > >http://www.rtlinux.org/ > > > ------------------------------------------------------------ > Pablo Alvarez, Ph.D. Phone: (617) > 353-1423 > Boston University Fax: (617) > 353-1414 > Dept. of Psychology email: > [EMAIL PROTECTED] > 64 Cummington Street > Boston, MA 02215, USA > ------------------------------------------------------------ > > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] > OR > echo "unsubscribe rtl <Your_email>" | mail > [EMAIL PROTECTED] > -- > For more information on Real-Time Linux see: > http://www.rtlinux.org/ > __________________________________________________ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/