This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
thread creation problem
- From: Aravind B <arvindb at cranessoftware dot com>
- To: ecos <ecos-discuss at sources dot redhat dot com>
- Date: 15 Sep 2004 18:10:56 +0530
- Subject: [ECOS] thread creation problem
On Wed, 2004-09-15 at 06:12, Aravind B wrote:
> On Wed, 2004-09-15 at 04:39, Andrew Lunn wrote:
> > On Wed, Sep 15, 2004 at 03:26:12PM +0530, Aravind B wrote:
> > >
> > >
> > > > Thanks for ur kind reply
> > > > After debugging i found that problem is in following code
fragment
> in
> > > > file thread.cxx:
> > > >
> > > > Cyg_Thread::add_to_list( void )
> > > > - 127 {
> > > > 128 // Add thread to housekeeping list
> > > > 129 Cyg_Scheduler::lock();
> > > > 130
> > > > - 131 if( thread_list == 0 )
> > > > 132 list_next = this;
> > > > 133 else {prev != thread_list
> > > > 134 Cyg_Thread *prev = thread_list;
> > > > - 135 do {
> > > > - 136 if ( this == prev )
> > > > 137 break; // found it already!
> > > > - 138 prev = prev->list_next;
> > > > - 139 } while ( prev != thread_list );
> > > > - 140 if ( this != prev ) {
> > > > 141 // insert it in the list:
> > > > - 142 list_next = thread_list->list_next;
> > > > - 143 thread_list->list_next = this;
> > > > 144 }
> > > > 145 }
> > > >
> > > > the control is in the while loop forever as prev == thread_list
(
> line
> > > > 139 )ie prev has become NULL.
> > >
> > > >Sounds like your stack is too small and you are overwriting the
> thread
> > > >structures.
> > > > Andrew
> > > But my stack size is 4096 bytes.
> >
> > How do you know that is big enough?
>
> >Also, how are your stacks declared? Looking at what you sent
> >yesterday,you created one thread with its stack stack[0] and the
other
> >threadwith its stack stack[1]. This looks possibly wrong to me.
> >Did you run the code with asserts enabled? (CYGPKG_INFRA_DEBUG on)
>
> >--
> >Gary Thomas <gary@mlbassoc.com>
> >MLB Associates
>
> thanks for the solution.
> this has solved my problem. (The problem was with the stack
> declaration)
>I'm glad your problem is solved. However, since you've asked for
>our help (gladly provided), how about sharing what you did wrong
>so that the next person to run afoul of this can find the answer
>in the archives? It only seems fair...
>--
>Gary Thomas <gary@mlbassoc.com>
>MLB Associates
Iam very glad to share my ideas with other peers in this group.
Actually i had declared pointer to the stack base as
char thread_a_stack[12][4096]
Now i changed it to char thread_a_stack[4096]
its working fine
rgds,
Aravind.B
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss