Skip to content

Commit c70bc16

Browse files
committed
CDRIVER-1431 document pool's thread safety
1 parent bbd15c1 commit c70bc16

11 files changed

+21
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Thread Safety
2+
-------------
3+
4+
This function can only be called once on a pool, and must be called before the first call to :symbol:`mongoc_client_pool_pop`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Thread Safety
2+
-------------
3+
4+
This function is safe to call from multiple threads.

doc/mongoc_client_pool_max_size.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ Parameters
2020
* ``pool``: A :symbol:`mongoc_client_pool_t <mongoc_client_pool_t>`.
2121
* ``max_pool_size``: The maximum number of connections which shall be available from the pool.
2222

23+
.. include:: includes/mongoc_client_pool_thread_safe.txt

doc/mongoc_client_pool_min_size.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ Parameters
2020
* ``pool``: A :symbol:`mongoc_client_pool_t <mongoc_client_pool_t>`.
2121
* ``min_pool_size``: The minimum number of connections which shall be kept in the pool.
2222

23+
.. include:: includes/mongoc_client_pool_thread_safe.txt
24+
25+
Subsequent calls to :symbol:`mongoc_client_pool_push` respect the new minimum size, and close the least recently used :symbol:`mongoc_client_t` if the minimum size is exceeded.

doc/mongoc_client_pool_pop.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ Returns
2323

2424
A :symbol:`mongoc_client_t <mongoc_client_t>`.
2525

26+
.. include:: includes/mongoc_client_pool_thread_safe.txt

doc/mongoc_client_pool_push.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ Parameters
1919
* ``pool``: A :symbol:`mongoc_client_pool_t <mongoc_client_pool_t>`.
2020
* ``client``: A :symbol:`mongoc_client_t <mongoc_client_t>`.
2121

22+
.. include:: includes/mongoc_client_pool_thread_safe.txt

doc/mongoc_client_pool_set_apm_callbacks.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Synopsis
1515
1616
Register a set of callbacks to receive Application Performance Monitoring events.
1717

18-
This function can only be called once on a pool, and must be called before the first :symbol:`mongoc_client_pool_pop <mongoc_client_pool_pop>`.
19-
2018
Parameters
2119
----------
2220

@@ -29,6 +27,8 @@ Returns
2927

3028
Returns true on success, otherwise false and an error is logged.
3129

30+
.. include:: includes/mongoc_client_pool_call_once.txt
31+
3232
See Also
3333
--------
3434

doc/mongoc_client_pool_set_appname.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Synopsis
1313
1414
This function is identical to :symbol:`mongoc_client_set_appname() <mongoc_client_set_appname>` except for client pools.
1515

16-
This function can only be called once on a pool, and must be called before the first :symbol:`mongoc_client_pool_pop <mongoc_client_pool_pop>`.
17-
1816
Also note that :symbol:`mongoc_client_set_appname() <mongoc_client_set_appname>` cannot be called on a client retrieved from a client pool.
1917

2018
Parameters
@@ -28,3 +26,4 @@ Returns
2826

2927
true if the appname is set successfully. Otherwise, false.
3028

29+
.. include:: includes/mongoc_client_pool_call_once.txt

doc/mongoc_client_pool_set_error_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ Returns
2525

2626
Returns true if the error API version was set, or logs an error message and returns false.
2727

28+
.. include:: includes/mongoc_client_pool_call_once.txt

doc/mongoc_client_pool_set_ssl_opts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ Synopsis
1616
1717
This function is identical to :symbol:`mongoc_client_set_ssl_opts() <mongoc_client_set_ssl_opts>` except for client pools. It ensures that all clients retrieved from :symbol:`mongoc_client_pool_pop() <mongoc_client_pool_pop>` or :symbol:`mongoc_client_pool_try_pop() <mongoc_client_pool_try_pop>` are configured with the same SSL settings.
1818

19-
It is a programming error to call this function after retrieving a client from the client pool.
20-
2119
Beginning in version 1.2.0, once a pool has any SSL options set, all connections use SSL, even if ``ssl=true`` is omitted from the MongoDB URI. Before, SSL options were ignored unless ``ssl=true`` was included in the URI.
2220

2321
Parameters
@@ -26,6 +24,8 @@ Parameters
2624
* ``pool``: A :symbol:`mongoc_client_pool_t <mongoc_client_pool_t>`.
2725
* ``opts``: A :symbol:`mongoc_ssl_opt_t <mongoc_ssl_opt_t>` that will not be modified.
2826

27+
.. include:: includes/mongoc_client_pool_call_once.txt
28+
2929
Availability
3030
------------
3131

0 commit comments

Comments
 (0)