Skip to content

Commit f498cfa

Browse files
committed
clarify that ParallelImageCapture holds references to the buffers until capture_stop
1 parent 0ac6adb commit f498cfa

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

shared-bindings/imagecapture/ParallelImageCapture.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,15 @@ STATIC mp_obj_t imagecapture_parallelimagecapture_capture(mp_obj_t self_in, mp_o
9797
}
9898
STATIC MP_DEFINE_CONST_FUN_OBJ_2(imagecapture_parallelimagecapture_capture_obj, imagecapture_parallelimagecapture_capture);
9999

100-
//| def continuous_capture_start(self, buffer1: WriteableBuffer, buffer2: WriteableBuffer) -> None:
100+
//| def continuous_capture_start(self, buffer1: WriteableBuffer, buffer2: WriteableBuffer, /) -> None:
101101
//| """Begin capturing into the given buffers in the background.
102102
//|
103103
//| Call `continuous_capture_get_frame` to get the next available
104-
//| frame, and `continuous_capture_stop` to stop capturing."""
104+
//| frame, and `continuous_capture_stop` to stop capturing.
105+
//|
106+
//| Until `continuous_capture_stop` (or `deinit`) is called, the
107+
//| `ParallelImageCapture` object keeps references to ``buffer1`` and
108+
//| ``buffer2``, so the objects will not be garbage collected."""
105109
//| ...
106110
//|
107111
STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_start(mp_obj_t self_in, mp_obj_t buffer1, mp_obj_t buffer2) {
@@ -125,7 +129,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_continuous_ca
125129

126130

127131
//| def continuous_capture_stop(self) -> None:
128-
//| """Stop continuous capture"""
132+
//| """Stop continuous capture.
133+
//|
134+
//| Calling this method also causes the object to release its
135+
//| references to the buffers passed to `continuous_capture_start`,
136+
//| potentially allowing the objects to be garbage collected."""
129137
//| ...
130138
//|
131139
STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_stop(mp_obj_t self_in) {

0 commit comments

Comments
 (0)