This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Thread error with large buffer


Oops, looks like I'm going to have to look more carefully from now on.
I'm answering my own questions to damn much after posting to the list.

Anyhow, I changed the stack size of the thread.  I was thinking it had
something to do with stack size, but I didn't realize that threads had
their own stack.  Oops! :)

  > -----Original Message-----
  > From: Trenton D. Adams [mailto:tadams@extremeeng.com]
  > Sent: Thursday, July 19, 2001 4:18 PM
  > To: 'eCos mailing list'
  > Subject: Thread error with large buffer
  > 
  > I'm doing some network tests to test the things some of us were
talking
  > about before with send sending everything before returning.  I get
the
  > output below.
  > 
  > Transfer rate: 656912 bits/sec, 306 bytes/write.
  > TRACE: <4>[88]int main() This is the system-supplied default main()
  > TRACE: <4>[107]void cyg_libc_invoke_main() main() has returned with
code
  > 0. Calling exit()
  > TRACE: <4>[84]void exit() Calling fflush( NULL )
  > Start socket test
  > ASSERT FAIL: <2>[166]static void Cyg_Scheduler::unlock_inner() Bad
next
  > thread
  > 
  > 
  > Below is the thread.  It doesn't give the error above if the buffer
  > variable is 400.  Anyone have any ideas why this might be?  Surely a
  > static buffer of 4K is not un-reasonable?
  > net_test(cyg_addrword_t param)
  > {
  >     int s;
  >     int one = 1;
  >     int index;
  >     struct sockaddr_in addr;
  > 
  >     char buffer[4000];
  > 
  >     buffer[0] = '\0';
  > 
  >     diag_printf("Start socket test\n");
  >     init_all_network_interfaces();
  > 
  >     for (index = 0; index < 78; index++)
  >     {
  >         strcat (buffer,
  >             "Hello From eCos! Hello From eCos! Hello From eCos!\n");
  >     }
  > 
  > 
  >     s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  >     diag_printf("socket() = %d\n", s);
  > 
  >     diag_printf ("%x", inet_addr ("172.16.1.9"));
  >     addr.sin_addr.s_addr = inet_addr ("172.16.1.9");
  >     addr.sin_family = AF_INET;
  >     addr.sin_port = htons (1024);
  >     addr.sin_len = sizeof (addr);
  >     if (connect (s, &addr, sizeof (addr)) != 0)
  >     {
  >         diag_printf ("Error connecting to socket! - %d\n",
  >             errno);
  >         cyg_test_exit();
  >     }
  > 
  >     if (send (s, buffer, strlen (buffer), 0) != 0)
  >     {
  >         diag_printf ("Error sending to socket! - %d\n",
  >             errno);
  >         cyg_test_exit();
  >     }
  > 
  > 
  >     cyg_test_exit();
  > }
  > 
  > Trenton D. Adams
  > Embedded Developer
  > Windows Developer
  > Extreme Engineering Ltd.
  > Calgary Alberta.
  > 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]