Dans la documentation, on peut trouver l’information suivante :“Don’t use too many threads. Try not to use more than one thread per module. Don’t create threads for one-time tasks. Usually, many tasks can be handled by an event loop that runs in a single thread.”
J’ai testé, en déclarant deux thread_create(), la compilation OK, flash OK mais l’exécution s’est plantée avec reboot !!
/**
- \pre Create the thread to read lsm303dhc accelerometer and magnetometer sensors
/
thread_create(stack_1, sizeof(stack_1), THREAD_PRIORITY_MAIN - 1,
0, lsm303dlhc_3d_th, NULL, “lsm303dlhc”);
/* - \pre Create the thread to reald isl29020 luxmeter
*/
thread_create(stack_isl29020, sizeof(stack_isl29020), THREAD_PRIORITY_MAIN - 2,
0, isl29020_th, NULL, “isl29020”);
Pourquoi ?
- c’est vraiment interdit
- on peut seulement utiliser une seule fois thread_create(), puis ajouter les threads