MCPcopy Create free account
hub / github.com/Bareflank/hypervisor / thread_func

Function thread_func

lib/tests/src/basic_spinlock_t/behavior.cpp:53–73  ·  view source on GitHub ↗

<!-- description --> @brief Used to test to make sure that threads have to wait

Source from the content-addressed store, hash-verified

51 /// @brief Used to test to make sure that threads have to wait
52 ///
53 void
54 thread_func(bsl::safe_u16 const &ppid) noexcept
55 {
56 bool mut_this_thread_waited{};
57
58 auto *const pmut_tls{g_mut_tls_wait.at_if(bsl::to_idx(ppid))};
59 pmut_tls->ppid = ppid.get();
60
61 ++g_mut_threads_started;
62
63 g_mut_spinlock.lock(*pmut_tls);
64 while (static_cast<bsl::uint64>(g_mut_threads_started) < MAX_WAIT_THREADS) {
65 if (!mut_this_thread_waited) {
66 ++g_mut_threads_that_waited;
67 mut_this_thread_waited = true;
68 }
69
70 helpers::yield();
71 }
72 g_mut_spinlock.unlock();
73 }
74
75 /// <!-- description -->
76 /// @brief Used to execute the actual checks. We put the checks in this

Callers

nothing calls this directly

Calls 3

yieldFunction · 0.70
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected