File tree Expand file tree Collapse file tree 4 files changed +8
-0
lines changed
build/future_function_templates Expand file tree Collapse file tree 4 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ future_wait (future_t *future)
9191 mongoc_mutex_unlock (&future->mutex);
9292
9393 if (resolved) {
94+ future->awaited = true;
95+
9496 /* free memory */
9597 mongoc_thread_join (future->thread);
9698 }
@@ -102,6 +104,7 @@ future_wait (future_t *future)
102104void
103105future_destroy (future_t *future)
104106{
107+ assert (future->awaited);
105108 bson_free (future->argv);
106109 mongoc_cond_destroy (&future->cond);
107110 mongoc_mutex_destroy (&future->mutex);
Original file line number Diff line number Diff line change 1111typedef struct
1212{
1313 bool resolved;
14+ bool awaited;
1415 future_value_t return_value;
1516 int argc;
1617 future_value_t *argv;
Original file line number Diff line number Diff line change @@ -328,6 +328,8 @@ future_wait (future_t *future)
328328 mongoc_mutex_unlock (& future -> mutex );
329329
330330 if (resolved ) {
331+ future -> awaited = true;
332+
331333 /* free memory */
332334 mongoc_thread_join (future -> thread );
333335 }
@@ -339,6 +341,7 @@ future_wait (future_t *future)
339341void
340342future_destroy (future_t * future )
341343{
344+ assert (future -> awaited );
342345 bson_free (future -> argv );
343346 mongoc_cond_destroy (& future -> cond );
344347 mongoc_mutex_destroy (& future -> mutex );
Original file line number Diff line number Diff line change 1717typedef struct
1818{
1919 bool resolved ;
20+ bool awaited ;
2021 future_value_t return_value ;
2122 int argc ;
2223 future_value_t * argv ;
You can’t perform that action at this time.
0 commit comments