Opened 11 months ago

Closed 4 months ago

#9169 closed feature request (fixed)

Add mkWeakTMVar to Control.Concurrent.STM.TMVar

Reported by: basvandijk Owned by: thoughtpolice
Priority: normal Milestone: 7.10.1
Component: Core Libraries Version: 7.8.2
Keywords: stm Cc: core-libraries-committee@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I just needed a Weak pointer to a TMVar:

-- | Make a 'Weak' pointer to a 'TMVar', using the second argument as
-- a finalizer to run when 'TMVar' is garbage-collected.
mkWeakTMVar :: TMVar a -> IO () -> IO (Weak (TMVar a))
mkWeakTMVar tmv@(TMVar (TVar t#)) f = IO $ \s ->
    case mkWeak# t# tmv f s of (# s1, w #) -> (# s1, Weak w #)

It might make sense to add a similar function for TSem as well.

Attachments (1)

0001-Add-mkWeakTMVar-to-Control.Concurrent.STM.TMVar.patch (2.7 KB) - added by basvandijk 11 months ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 months ago by Austin Seipp <austin@…>

In b0316cdb10fbd9eaca7ede28c7bb3eb19f7766bf/ghc:

reading/writing blocking FDs over FD_SETSIZE is broken (Partially Trac #9169)

Summary:
libraries/base/cbits/inputReady.c had no limits on file descriptors.
Add a limit as non-threaded RTS does.

Signed-off-by: Sergei Trofimovich <[email protected]>

Test Plan: none

Reviewers: austin, simonmar

Reviewed By: austin, simonmar

Subscribers: simonmar, relrod, carter

Differential Revision: https://phabricator.haskell.org/D28

comment:2 Changed 10 months ago by thoughtpolice

  • Status changed from new to patch

Sorry, this commit had the wrong trac number, it seems!

comment:3 Changed 10 months ago by thoughtpolice

  • Milestone set to 7.10.1

comment:4 Changed 8 months ago by thoughtpolice

  • Status changed from patch to upstream

comment:5 Changed 6 months ago by thoughtpolice

  • Component changed from libraries (other) to Core Libraries

Moving over to new owning component 'Core Libraries'.

comment:6 Changed 5 months ago by simonmar

  • Cc core-libraries-committee@… added
  • Owner set to thoughtpolice

Patch looks fine.

comment:7 Changed 4 months ago by Austin Seipp <austin@…>

In 8afdf274194e77e85e6a08dc4963022c56fc29d8/ghc:

stm: update submodule for #9169 addition

Signed-off-by: Austin Seipp <[email protected]>

comment:8 Changed 4 months ago by thoughtpolice

  • Resolution set to fixed
  • Status changed from upstream to closed

Merged, thanks!

Note: See TracTickets for help on using tickets.