Note that there are some explanatory texts on larger screens.

plurals
  1. POlocks/condition variables issue
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COIf (**and only if**) access from C to the resource doesn't need to be serialized then you do not need to put any lock on C BUT this is a pretty strange situation (to run concurrently doesn't mean that they can access a shared resource in the same moment). Please post more details about what you want to do and what OS/language you're using
      singulars
    2. COI'm writing my code in C on my mac. So the shared resource here is a branch of a bank, functions A and B are withdrawal and deposit respectively, and C is transfer. I am not supposed to be able to concurrently do a withdrawal and deposit from the same branch (even on different accounts in the branch) but I can do transfers concurrently within the branch as long as the accounts doing the transferring are not the same as the ones handling a deposit/withdrawal. This has to do with keeping the total branch balance from being corrupted.
      singulars
    3. COSo just do not put any lock for transferring (but you'll have to lock somehow at a lower level for account). How to implement this depends on what you're using (is this an example and you access a database directly? you talk with some kind of service?). Personally I wouldn't use a double lock so I would use a account-level locking (for A, B and C) expanding to _any account_ for A and B. Because these operations comes from human users you may think to use a mechanism like the _optimistic lock_ commonly used in DB for A/B vs C and a simple sw lock for A and B.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload