|
我看threadx的例程,线程的堆栈分配如下:
从内存池中分配一块内存给线程使用
tx_byte_allocate(&byte_pool_0, (VOID **) &pointer, DEMO_STACK_SIZE, TX_NO_WAIT);
tx_thread_create(&thread_0, "thread 0", thread_0_entry, 0,
pointer, DEMO_STACK_SIZE,
1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
如果我直接给它指定一个内存数组可不可以?
char thread_0_stack[2048];
_tx_thread_create(&thread_0, "thread 0", thread_0_entry, 0,
thread_0_stack, 2048,
1, 1, TX_NO_TIME_SLICE, TX_AUTO_START);
例程这样写的好处在哪里?
|
|