[m-rev.] for review: Deprecate thread.channel.untake/4

Peter Wang novalazy at gmail.com
Mon Feb 17 11:30:48 AEDT 2020


A call to channel.untake will deadlock if a call to channel.take is
blocked on the same channel.
unGetChan was removed from GHC for the same reason:
https://gitlab.haskell.org/ghc/ghc/issues/4154

library/thread.channel.m:
    Deprecate channel.untake/4.

NEWS:
    Announce the change.

diff --git a/NEWS b/NEWS
index 228f97f02..412df8d12 100644
--- a/NEWS
+++ b/NEWS
@@ -62,6 +62,13 @@ Changes to the Mercury standard library
     - func `hash/1`
     - pred `hash/2`
 
+### Changes to the `thread.channel` module
+
+* The following predicate has been deprecated and will be removed in a future
+  release:
+
+    - pred `untake/4`
+
 ### Changes to the `map` module
 
 * The following function and predicate have been added:
diff --git a/library/thread.channel.m b/library/thread.channel.m
index 0c3da2bfd..09376af24 100644
--- a/library/thread.channel.m
+++ b/library/thread.channel.m
@@ -56,6 +56,10 @@
 
     % Place an item back at the start of the channel.
     %
+    % WARNING: a call to `channel.untake' will deadlock if a call to
+    % `channel.take' is blocked on the same channel.
+    %
+:- pragma obsolete(untake/4).
 :- pred untake(channel(T)::in, T::in, io::di, io::uo) is det.
 
 %---------------------------------------------------------------------------%
-- 
2.25.0



More information about the reviews mailing list