A shared recursive mutex in standard C++

Recursive property of the mutex operates with the term “owner“, which in case of a shared_mutex is not well-defined: several threads may have .lock_shared() called at the same time. Assuming “owner” to be a thread which calls .lock() (not .lock_shared()!), an implementation of the recursive shared mutex can be simply derived from shared_mutex: class shared_recursive_mutex: … Read more

Python Flask shutdown event handler

There is no app.stop() if that is what you are looking for, however using module atexit you can do something similar: https://docs.python.org/2/library/atexit.html Consider this: import atexit #defining function to run on shutdown def close_running_threads(): for thread in the_threads: thread.join() print “Threads complete, ready to finish” #Register the function to be called on exit atexit.register(close_running_threads) #start … Read more

BackgroundWorker RunWorkerCompleted Event

If the BackgroundWorker was created from the UI thread, then the RunWorkerCompleted event will also be raised on the UI thread. If it was created from a background thread, the event will be raised on an undefined background thread (not necessarily the same thread, unless you’re using a custom SynchronizationContext). Interestingly, this doesn’t seem to … Read more

Python in docker – RuntimeError: can’t start new thread

Solution to this problem was to upgrade docker from version 18.06.1-ce to 20.10.7. Why? This is because the default seccomp profile of Docker 20.10.9 is not adjusted to support the clone() syscall wrapper of glibc 2.34 adopted in Ubuntu 21.10 and Fedora 35. Source: ubuntu:21.10 and fedora:35 do not work on the latest Docker (20.10.9)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)