8 #include <zephyr/kernel.h> 
    9 #include <zephyr/arch/cpu.h> 
   10 #include <zephyr/sys/arch_interface.h> 
   17 #define COUNT_LIMIT 12 
   19 #define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE) 
   36   for (
int i = 0; i < 
TCOUNT; i++) {
 
   48         printk(
"%s: thread %d, count = %d  Threshold reached.",
 
   49                                                       __func__, my_id, count);
 
   50         count_threshold_cv.notify_one();
 
   51         printk(
"Just sent signal.\n");
 
   54       printk(
"%s: thread %d, count = %d, unlocking mutex\n",
 
   55                                                       __func__, my_id, count);
 
   65   printk(
"Starting %s: thread %d\n", __func__, my_id);
 
   70     printk(
"%s: thread %d Count= %d. Going into wait...\n",
 
   71           __func__, my_id, count);
 
   73     count_threshold_cv.wait(lk);
 
   75     printk(
"%s: thread %d Condition signal received. Count= %d\n",
 
   76           __func__, my_id, count);
 
   79   printk(
"%s: thread %d Updating the value of count...\n",
 
   82   printk(
"%s: thread %d count now = %d.\n", __func__, my_id, count);
 
   83   printk(
"%s: thread %d Unlocking mutex.\n", __func__, my_id);
 
  104   printk(
"Main(): Waited and joined with %d threads. Final value of count = %d. Done.\n",
 
A condition variable class.
lock_guard using zpp::mutex as a lock.
Thread creation attributes.
thread_data holds the stack and thread control block memory
static constexpr thread_prio preempt(int prio) noexcept
Create a preemptive priority value.
The class thread repecents a single Zephyr thread.
zpp::unique_lock using zpp::mutex as a lock.
auto sleep_for(const std::chrono::duration< T_Rep, T_Period > &sleep_duration)
Suspend the current thread for a specified time duration.
int main(int argc, char *argv[])
void inc_count(int my_id) noexcept
void watch_count(int my_id) noexcept
#define ZPP_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size)