samples: synchronisation: run thread_b on cpu 0 in SMP mode
Always run thread_b on CPU 0 by setting cpu_mask if on SMP system. Run this with CONFIG_SCHED_CPU_MASK=y set on an SMP system. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
c916411239
commit
ad8caa65e8
|
@ -1,3 +1,3 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
# enable to use thread names
|
||||
#CONFIG_THREAD_NAME=y
|
||||
CONFIG_THREAD_NAME=y
|
||||
|
|
|
@ -97,9 +97,14 @@ void threadA(void *dummy1, void *dummy2, void *dummy3)
|
|||
/* spawn threadB */
|
||||
k_tid_t tid = k_thread_create(&threadB_data, threadB_stack_area,
|
||||
STACKSIZE, threadB, NULL, NULL, NULL,
|
||||
PRIORITY, 0, K_NO_WAIT);
|
||||
PRIORITY, 0, K_FOREVER);
|
||||
|
||||
k_thread_name_set(tid, "thread_b");
|
||||
#if CONFIG_SCHED_CPU_MASK
|
||||
k_thread_cpu_mask_disable(&threadB_data, 1);
|
||||
k_thread_cpu_mask_enable(&threadB_data, 0);
|
||||
#endif
|
||||
k_thread_start(&threadB_data);
|
||||
|
||||
/* invoke routine to ping-pong hello messages with threadB */
|
||||
helloLoop(__func__, &threadA_sem, &threadB_sem);
|
||||
|
|
Loading…
Reference in a new issue