You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromPtr $ do ... uses mask_, thus making anything it wraps uninterruptible.
This means that common code such as
fromPtr $ [C.block|Mat * {
// long-running C++ computation here
}|]
will hang, not properly reacting to Ctrl+C, timeout, asynccancellation, or other async exceptions.
Of course the C/C++ part itself cannot be interrupted anyway because it is a foreign call (unless foreign import ccall interruptible is used, which it isn't and which would need the called code to provide the necessary guarantees).
But the user of fromPtr should be made more explicitly aware that mask_ is going on, so that they ensure to not write any unnecessary Haskell code under it.
Solution
fromPtr is in OpenCV.Internal.C.Types and doesn't seem to be re-exported to public APIs, so I think we should rename it to fromPtrWithMask, and deprecate the old name (but keep it forever).
The text was updated successfully, but these errors were encountered:
nh2
changed the title
fromPtr and uses are bad (uninterruptible) because they mask_
fromPtr should have a more explicit name that points out use of mask_
Oct 19, 2024
fromPtr $ do ...
usesmask_
, thus making anything it wraps uninterruptible.This means that common code such as
will hang, not properly reacting to Ctrl+C,
timeout
,async
cancel
lation, or other async exceptions.Of course the C/C++ part itself cannot be interrupted anyway because it is a foreign call (unless
foreign import ccall interruptible
is used, which it isn't and which would need the called code to provide the necessary guarantees).But the user of
fromPtr
should be made more explicitly aware thatmask_
is going on, so that they ensure to not write any unnecessary Haskell code under it.Solution
fromPtr
is inOpenCV.Internal.C.Types
and doesn't seem to be re-exported to public APIs, so I think we should rename it tofromPtrWithMask
, and deprecate the old name (but keep it forever).The text was updated successfully, but these errors were encountered: