c++ Programming Glossary: lock
Does the 'mutable' keyword have any purpose other than allowing the variable to be modified by a const function? http://stackoverflow.com/questions/105014/does-the-mutable-keyword-have-any-purpose-other-than-allowing-the-variable-to a boost mutex as mutable allowing const functions to lock it for thread safety reasons but to be honest it feels like.. way that is visible through the public interface like your locking example. Another example would be a class that computes a..
Is there a production ready lock-free queue or hash implementation in C++ http://stackoverflow.com/questions/1164023/is-there-a-production-ready-lock-free-queue-or-hash-implementation-in-c there a production ready lock free queue or hash implementation in C I ve been googling quite.. implementation in C I ve been googling quite a bit for a lock free queue in C . I found some code and some trials but nothing.. and some trials but nothing that i was able to compile. A lock free hash would also be welcome. SUMMARY So far i have no positive..
Visual Studio support for new C / C++ standards? http://stackoverflow.com/questions/146381/visual-studio-support-for-new-c-c-standards of affairs but also makes sense if you suspect MS wants to lock users in it makes it very hard to port modern gcc based code..
Does C++ support 'finally' blocks? (And what's this 'RAII' I keep hearing about?) http://stackoverflow.com/questions/161177/does-c-support-finally-blocks-and-whats-this-raii-i-keep-hearing-about C support 'finally' blocks And what's this 'RAII' I keep hearing about Does C support.. 'RAII' I keep hearing about Does C support ' finally ' blocks What is the RAII idiom What is the difference between C 's.. improve this question No C does not support 'finally' blocks. The reason is that C instead supports RAII Resource Acquisition..
Reader/Writer Locks in C++ http://stackoverflow.com/questions/244316/reader-writer-locks-in-c Writer Locks in C I'm looking for a good reader writer lock in C . We have a use case of a single infrequent writer and.. a Windows only one would be acceptable. c multithreading locking share improve this question Newer versions of boost thread.. question Newer versions of boost thread have read write locks 1.35.0 and later apparently the previous versions did not work..
What C++ Smart Pointer Implementations are available? http://stackoverflow.com/questions/5026197/what-c-smart-pointer-implementations-are-available you'll first need to access the std shared_ptr by calling lock which will return an empty std shared_ptr if the owned pointer.. to a boost shared_ptr . You not surprisingly call lock to access the strong shared pointer and must check to make sure..
smart pointers (boost) explained http://stackoverflow.com/questions/569775/smart-pointers-boost-explained by shared_ptr. If you need to access the object you can lock the management of it to avoid that in another thread a shared_ptr..
I've heard i++ isn't thread safe, is ++i thread-safe? http://stackoverflow.com/questions/680097/ive-heard-i-isnt-thread-safe-is-i-thread-safe instructions. Or it may be smart and compile it into lock disable task switching interrupts load r0 i load memory into.. r0 increment reg 0 stor i r0 store reg 0 back to memory unlock enable task switching interrupts where lock disables and unlock.. to memory unlock enable task switching interrupts where lock disables and unlock enables interrupts. But even then this may..
Which kind of pointer do I use when? http://stackoverflow.com/questions/8706192/which-kind-of-pointer-do-i-use-when you can test if the parent shared_ptr is alive with lock which will return a shared_ptr that is non null if the resource..
Example for boost shared_mutex (multiple reads/one write)? http://stackoverflow.com/questions/989795/example-for-boost-shared-mutex-multiple-reads-one-write threads to be able to read simultaneously and only lock them out when an update is needed the updating thread could.. _access void reader get shared access boost shared_lock boost shared_mutex lock _access now we have shared access void.. get shared access boost shared_lock boost shared_mutex lock _access now we have shared access void writer get upgradable..
Win32 Read/Write Lock Using Only Critical Sections http://stackoverflow.com/questions/1008726/win32-read-write-lock-using-only-critical-sections Read Write Lock Using Only Critical Sections I have to implement a read write..
Thread pool using boost asio http://stackoverflow.com/questions/12215395/thread-pool-using-boost-asio that will Invoke the user function or callable object. Lock the mutex and decrement the counter. I may not be understanding..
Call Python from C++ http://stackoverflow.com/questions/1417473/call-python-from-c so this is going to fail Read up on the Global Interpreter Lock GIL in the Python manual. Perhaps the following links will help.. http docs.python.org c api init.html#PyEval 5FAcquireLock http docs.python.org c api init.html#PyEval 5FReleaseLock The.. http docs.python.org c api init.html#PyEval 5FReleaseLock The GIL is mentioned on Wikipedia http en.wikipedia.org wiki..
boost, shared ptr Vs weak ptr? Which to use when? http://stackoverflow.com/questions/2036182/boost-shared-ptr-vs-weak-ptr-which-to-use-when You have defined behavior if the object doesn't exist Lock on a weak pointer returns a strong pointer this is how you access..
Atomic swap in GNU C++ http://stackoverflow.com/questions/2478397/atomic-swap-in-gnu-c when you copy load the rt_data pointer to your local copy. Lock free programming is tricky. If you're willing to use Gcc's c..
Lock Free Queue — Single Producer, Multiple Consumers http://stackoverflow.com/questions/2702328/lock-free-queue-single-producer-multiple-consumers Free Queue &mdash Single Producer Multiple Consumers I am looking.. are this lock free makes me independent of the scheduler. Lock based programming depends on the scheduler to make sure that..
Least Recently Used cache using C++ http://stackoverflow.com/questions/3639744/least-recently-used-cache-using-c your object into a mutex and provide a std unique_ptr Lock lock method in debug you can assert than the lock is taken at..
how to make an application thread safe? http://stackoverflow.com/questions/5125241/how-to-make-an-application-thread-safe protecting from thread unsafe modifications. Mutexes and Locks are very useful but with great power comes great responsibility... a singleton it won't work right. Beware the Double Checked Lock Paradigm. Most people who use it get it wrong in some subtle..
Locking strategies and techniques for preventing deadlocks in code http://stackoverflow.com/questions/6012640/locking-strategies-and-techniques-for-preventing-deadlocks-in-code strategies and techniques for preventing deadlocks in code.. A and then B and T2 accesses resource B and then A. Locking the resources in the order they are needed causes a dead.. the resources. Problematic situation Thread1 Thread2 Lock Resource A Lock Resource B Do Resource A thing... Do Resource..
Double-Checked Lock Singleton in C++11 http://stackoverflow.com/questions/6086912/double-checked-lock-singleton-in-c11 Checked Lock Singleton in C 11 Is the following singleton implementation..
boost.python not supporting parallelism? http://stackoverflow.com/questions/8009613/boost-python-not-supporting-parallelism What you are running into is the python Global Interpreter Lock. The GIL only allows one thread at a time to run in the python..
How can I intercept all key events, including ctrl+alt+del and ctrl+tab? http://stackoverflow.com/questions/886076/how-can-i-intercept-all-key-events-including-ctrlaltdel-and-ctrltab as if the user had pressed Ctrl Alt Del and then selected Lock this computer . To unlock the computer they would then need..
Does the semantics of `std::memory_order_acquire` requires processor instructions on x86/x86_64? http://stackoverflow.com/questions/18576986/does-the-semantics-of-stdmemory-order-acquire-requires-processor-instruction atomic.store val std memory_order_seq_cst which requires LOCK XCHG or alternative MOV into memory MFENCE . Processor memory..
Why GCC does not use LOAD(without fence) and STORE+SFENCE for std::memory_order_seq_cst? http://stackoverflow.com/questions/19047327/why-gcc-does-not-use-loadwithout-fence-and-storesfence-for-stdmemory-order LOAD without fence and STORE MFENCE LOAD without fence and LOCK XCHG MFENCE LOAD and STORE without fence LOCK XADD 0 and STORE.. fence and LOCK XCHG MFENCE LOAD and STORE without fence LOCK XADD 0 and STORE without fence As it is written here http www.cl.cam.ac.uk.. implementation Load Seq_Cst MOV from memory Store Seq Cst LOCK XCHG alternative MOV into memory MFENCE Note there is an alternative..
Memory model ordering and visibility? http://stackoverflow.com/questions/7461484/memory-model-ordering-and-visibility stronger ordering with either an MFENCE instruction or a LOCK prefixed instruction there is an implementation choice here.. memory_order_seq_cst is not again requiring an MFENCE or LOCK ed instruction . An important effect of the ordering constraints..
A simple C++ shared memory program written on linux: segmentation fault http://stackoverflow.com/questions/8189638/a-simple-c-shared-memory-program-written-on-linux-segmentation-fault vector #include iostream using namespace std struct LOCK string name string type vector string pids int main int segment_id.. string type vector string pids int main int segment_id LOCK shared_memory struct shmid_ds shmbuffer int segment_size const.. S_IWUSR Attach the shared memory segment. shared_memory LOCK shmat segment_id 0 0 printf shared memory attached at address..
Is Critical Section always faster? http://stackoverflow.com/questions/853316/is-critical-section-always-faster API is I think implemented in user mode as a LOCK INC opcode ... in other words you can acquire an uncontested..
How to use std::atomic efficiently http://stackoverflow.com/questions/8749038/how-to-use-stdatomic-efficiently these operations will incur the synchronization cost of a LOCK ed instruction or a fence my implementation puts the price on..
What does the “lock” instruction mean in x86 assembly? http://stackoverflow.com/questions/8891067/what-does-the-lock-instruction-mean-in-x86-assembly the Add c qt assembly share improve this question LOCK is not an instruction itself it is an instruction prefix which.. l ong word at the address held in the ecx register. The LOCK prefix ensures that the CPU has exclusive ownership of the appropriate..
|