On 10/31/2026 2:38 AM, bolt…@caprica.universe wrote:
> On Fri, 30 Oct 2026 20:37:14 +0100 > Jeroen Belleman <jero…@nospam.please> gabbled:
>> On 10/30/26 17:07, bolt…@caprica.universe wrote:
>>> On Fri, 30 Oct 2026 11:25:01 -0000 (UTC) >>> cro…@spitfire.i.gajendra.net (Dan Cross) gabbled:
>>>> In article <2026…@yahoo.com>, >>>> Michael S  <alre…@yahoo.com> wrote:
>>>>>> Only if you intended to close the TTY the programs were started >>>>>> on.  Otherwise, I don't see why it would be necessary:
>>>>> >>>>> What happens when caller is GUI-style application?
>>>> >>>> That depends on a number of factors, but basically, "it does the >>>> same thing".  Why would it be any different?
>>> >>> Windows treats GUI apps entirely differently to console ones so a Windows >>> dev might not appreciate that on unix there is no demarcation - a GUI app >>> simply has a network connection to the X server and it can either sit in >>> an event loop waiting for events - as per a windows main thread - or go do >>> other things and periodically check the X event list. >>>
>> >> That's where threads are useful: The GUI is one thread, and the "other things" are in one or more other threads. There are altogether too many >> programs that hang the GUI while "other things" are going on. That >> should never happen!
> > If its multithreaded but that still happens someone probably has created too > many critical sections with too many locks. >
Makes no sense at all. Have you taken a look at my multex? It can create a shit lod of mutexes, and never deadlock. It keeps a strict locking order. Sorts and dedups the mutexes. Also, notice that an object does not need its own mutex: So, I have the most recent version and coded up my old multex algo. It 100% dead lock free and allows a thread to locks multiple objects in any order and lock them. All of the lock ordering is taken care of in the finalize function. Basically a thread seeds its per thread lock indices with addresses to objects it wants to lock. Calls finalize, then locks them. Does its thing and then unlocks them. Fwiw, here is my Relacy test output: struct ct_multex_relacy_test_v000 65% (65536/100000) iterations: 100000 total time: 9390 throughput: 10649 D:\ct_dev\ct_msvc\projects\ct_relacy_test\x64\Debug\ct_relacy_test.exe (process 13356) exited with code 0 (0x0). Press any key to close this window . . . Any my code: #include <relacy/relacy.hpp> #include <cstdio> #include <cstddef> #include <cstdlib> #include <string> #include <vector> #if ! defined (NDEBUG) # define CT_DBG_PRINTF(e) std::printf e #else # define CT_DBG_PRINTF(e) ((void)0) #endif #define CT_THREADS (5) #define CT_MUTEX_TABLE_N (64) struct ct_mutex_table { rl::mutex m_mutexs[CT_MUTEX_TABLE_N]; std::size_t hash_ptr( void* p ) const { return rl::hash_ptr(p, CT_MUTEX_TABLE_N); } }; struct ct_thread_mutex_hash { std::vector<std::size_t> m_hashed_idxs; // must be before any locks! void finalize() { std::sort( m_hashed_idxs.begin(), m_hashed_idxs.end()); m_hashed_idxs.erase( std::unique( m_hashed_idxs.begin(), m_hashed_idxs.end()), m_hashed_idxs.end()); } // BEFORE WE CALL, WE NEED TO sort and dedup before this. void lock( ct_mutex_table& mutex_table ) { for (auto& mtx_idx : m_hashed_idxs) { rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx]; mtx.lock($); } } // does not really even need to be reversed... void unlock( ct_mutex_table& mutex_table ) { for (auto& mtx_idx : m_hashed_idxs) { rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx]; mtx.unlock($); } } }; struct ct_state { ct_mutex_table m_mutex_table; VAR_T(int) m_var_0 = 0; VAR_T(int) m_var_1 = 1; VAR_T(int) m_var_2 = 2; void worker_thread_a() { ct_thread_mutex_hash self_hash; self_hash.m_hashed_idxs.push_back( m_mutex_table.hash_ptr(&m_var_0)); self_hash.m_hashed_idxs.push_back( m_mutex_table.hash_ptr(&m_var_1)); self_hash.finalize(); self_hash.lock(m_mutex_table); VAR(m_var_0) = 42; VAR(m_var_1) = 128; self_hash.unlock(m_mutex_table); } void worker_thread_b() { ct_thread_mutex_hash self_hash; // Seed! { self_hash.m_hashed_idxs.push_back( m_mutex_table.hash_ptr(&m_var_1)); self_hash.m_hashed_idxs.push_back( m_mutex_table.hash_ptr(&m_var_0)); } // Okay... Finalize it... { self_hash.finalize(); } // Finally, we can lock the bastard! { self_hash.lock(m_mutex_table); { VAR(m_var_0) = 99; VAR(m_var_1) = 77; } self_hash.unlock(m_mutex_table); } } }; struct ct_multex_relacy_test_v000 : rl::test_suite<ct_multex_relacy_test_v000, CT_THREADS> { ct_state m_state = { }; void before() { // not sure to init m_state here. Is it already init? } void thread( unsigned tidx ) { if (tidx == 0) m_state.worker_thread_a(); else m_state.worker_thread_b(); } }; int main(int argc, char** argv) { { rl::test_params p; p.iteration_count = argc > 1 ? (unsigned)atoi(argv[1]) : 100000; p.execution_depth_limit = 100000; if (argc > 2) { std::string m = argv[2]; if (m == "full") p.search_type = rl::sched_full; else if (m == "bound") { p.search_type = rl::sched_bound; p.context_bound = argc > 3 ? atoi(argv[3]) : 2; } } rl::simulate<ct_multex_relacy_test_v000>(p); } return 0; } /* #include <relacy/relacy.hpp> #include <iostream> int main() { std::cout << "ct_relacy_test\n"; std::cout << "____________________________________________" << std::endl; { } std::cout << "____________________________________________" << std::endl; std::cout << "ct_relacy_test fin! :^)\n"; return 0; } */