Skip to content

Commit

Permalink
Document sparsepp thread safety - see issue #29
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Feb 4, 2017
1 parent 39bf0f5 commit 2d9eca0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,12 @@ int main(int argc, char* argv[])
}
```
## Thread safety
Sparsepp follows the trade safety rules of the Standard C++ library. In Particular:
- A single sparsepp hash table is thread safe for reading from multiple threads. For example, given a hash table A, it is safe to read A from thread 1 and from thread 2 simultaneously.
- If a single hash table is being written to by one thread, then all reads and writes to that hash table on the same or other threads must be protected. For example, given a hash table A, if thread 1 is writing to A, then thread 2 must be prevented from reading from or writing to A.
- It is safe to read and write to one instance of a type even if another thread is reading or writing to a different instance of the same type. For example, given hash tables A and B of the same type, it is safe if A is being written in thread 1 and B is being read in thread 2.

0 comments on commit 2d9eca0

Please sign in to comment.