This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
strange behavior with single thread
- From: Mandeep Sandhu <mandeepsandhu dot chd at gmail dot com>
- To: ecos-discuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Mon, 3 Aug 2009 14:53:04 +0530
- Subject: [ECOS] strange behavior with single thread
Hi All,
I have a _very_ simple thread app which I've modified from the
"twothreads.c" example.
It does nothing except start a thread in which I simply print a debug
message and declare
a var of "struct sockaddr_in". But on starting the app, it stops after a call to
cyg_thread_resume(), i.e the thread does not start!
I had originally written a limited DHCP server implementation (which
was not working)!
So on debugging I narrowed down the problem to a declaration of
"struct sockaddr_in"
variable.
So I thought I'd make a simple thread which just declares this var and
does nothing. And
even in this sample app (test.c) I saw the same problem. I've
allocated a big enough stack
for the thread - 4KB. Also, increasing the stack size does not help.
The source is pasted
below.
I know this is only some minor oversight from my side, but any
pointers will be very helpful
Thanks,
-mandeep
test.c:
#include <cyg/kernel/kapi.h>
#include <network.h>
cyg_thread test_s;
cyg_handle_t test_thread;
cyg_thread_entry_t test_start;
char stack[4096];
void test_start(cyg_addrword_t data)
{
diag_printf("TEST!\n");
struct sockaddr_in addr;
cyg_test_exit();
}
void cyg_user_start(void)
{
diag_printf("Configuring test thread...\n");
cyg_thread_create( 4,
test_start,
(cyg_addrword_t) 0,
"TEST Thread",
(void *) &stack,
4096,
&test_thread,
&test_s );
diag_printf("Starting test...\n");
cyg_thread_resume(test_thread);
}
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss