[CDRIVER-1431] Document thread safety for mongoc_client_pool functions Created: 28/Jul/16 Updated: 28/Jan/17 Resolved: 27/Jan/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | docs |
| Affects Version/s: | None |
| Fix Version/s: | 1.6.0 |
| Type: | Improvement | Priority: | Trivial - P5 |
| Reporter: | Ian Boros | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The docs for mongoc_client_pool_set_apm_callbacks say:
There's no check for whether or not a client has been popped already in this function, so I think we should add that. This might also be kind of a silly point, but I think this function should lock the client pool mutex, or (maybe) be described as "not thread safe" in the docs. In reality I'm sure nobody calls this function from multiple threads, but if someone did, the behavior would be weird. mongoc_client_pool_set_error_api should probably lock the pool's mutex or be described as "not thread safe" in the docs as well. I'm guessing nobody actually calls this from multiple threads either, so I don't think it's a "real" bug, but it does look a bit strange. |
| Comments |
| Comment by Githook User [ 28/Jan/17 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: |
| Comment by A. Jesse Jiryu Davis [ 29/Jul/16 ] |
|
Good idea. These functions - ones that must be called before the first pop - should take the mutex, check if any clients have been popped yet, and fail if so. They should be documented as "must be called before first client is popped", rather than being document as "not thread-safe". |