can you define: “only one works at a time”
Do you mean that 1) you can only create one thread at a time or do you mean 2) you believe that only one runs at a time?
If 1) can you supply the error that tx_thread_create returns?
If 2) how do you know that only one is running?
I have run applications with any number of threads so I know that multiple threads can simultaneously run.
I use this technique for, among other things a performance monitor thread that might show the relative amount of memory used or cpu utilization used while another thread is doing real work.
I think that only one thread appears to run at one time.
I can create both threads and tx_thread_create() returns TX_SUCCESS for each, so I know that they have been properly created.
Its the functions that have been called that dont appear to work. For testing purposes I have basic printf statements in each and when both threads are started, both functions are not executed.
I’ve looked a little more into the thread situation:
When either of the two threads are run individually the chip is able to run ok but when they are run at the same time it appears that the chip locks up; all other services I had running on it (Web and Telnet server) stop working and it doesnt even respond to ping anymore.
The only other things I can think to ask, and these are long shots, are you using separate TX_THREAD objects and separate stacks for each thread (that is mallocing space twice, once for thread 1 and one for thread 2 and declaring two TX_THREAD_OBJECTS one for thread 1 and one for thread2 )? Also, even more of a long shot, I generally memset the stack space to ‘\0’ before using it.
I do have an infinite loop in both threads but in each of them they run tx_thread_sleep() with a parameter of at least 200 timer ticks, so I would think that that would be enough to let the other thread get some time.