Skip to content

withMonitor should provide monitor reference #273

Open
@edsko

Description

@edsko

Currently withMonitor is defined as

withMonitor :: ProcessId -> Process a -> Process a
withMonitor pid code = bracket (monitor pid) unmonitor (\_ -> code)

but it should be defined as

withMonitor :: ProcessId -> (MonitorRef -> Process a) -> Process a
withMonitor pid = bracket (monitor pid) unmonitor

Although it is possible, using the existing withMonitor, to wait for a MonitorNotification that matches the appropriate ProcessId, if another monitor exists for the same process ID then this may remove the wrong message from the process's mailbox.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions