This is the mail archive of the ecos-discuss@sourceware.org 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]
Other format: [Raw text]

Re: ecos + lwip


Mandeep Sandhu wrote:
Threads that use lwip APIs (netcomm and sockets) *must* be created with
 sys_new_thread(). Otherwise lwip's timeout mechanism will not work as
expected.

Thanks for this info Simon.


I'm stuck at how to pass an app supplied arg to my threads start function that's
created using sys_thread_new().

I want to pass an arg to my threads start function. I think the 2nd arg to
sys_thread_new() seems to be user supplied arg, but from the usage I've seen
that apps usually pass the thread's name to it in the 2nd arg.

Internally, sys_thread_new uses this 2nd arg for both the name as well as the
arg to the start function while calling cyg_thread_create(). So is there no way
I can pass an arg to it (apart from the name)?

The implementation seems broken. I see three workarounds here:


1. Change the implementation to *not* use the user arg as the threads name, but provide a dummy name to cyg_create_thread() instead.
2. Define a struct with the first field being a dummy name, followed by any other fields you need and hand a pointer to this struct to sys_thread_new().
3. Use my new lwip port, which hopefully will soon be merged with eCos CVS. In the new release, sys_thread_new() takes both a thread name and a user argument, and uses them appropriately. Here is a preview release of lwip 1.3.1 for eCos. Just copy all the files in the archive over the eCos repository.


http://download.westlicht.ch/lwip-20090827.tar.gz

Simon

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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