Portability | portable |
---|---|
Stability | experimental |
Maintainer | Stefan Schmidt (stefanschmidt@web.de) |
Version : 0.1
This module offers the distributed MVar datatype.
The datatype behaves just like a normal MVar, but the content of the variable may be stored on a different DNode. When accessing the DMVar, the content will be fetched from the external node and written back.
It is guaranteed, that only one node at a time can take the content of the DMVar. Just like normal DMVars, you can produce deadlocks.
When a node dies which holds the content of a DMVar, the node which created the variable will reset its value to the last known value.
If the owner dies, the other nodes cannot access the content of the DMVar any more.
- data DMVar a
- newDMVar :: Binary a => String -> a -> IO (DMVar a)
- newEmptyDMVar :: Binary a => String -> IO (DMVar a)
- newRemoteDMVar :: String -> String -> IO (DMVar a)
- closeDMVar :: DMVar a -> IO ()
- readDMVar :: Binary a => DMVar a -> IO a
- takeDMVar :: Binary a => DMVar a -> IO a
- putDMVar :: Binary a => DMVar a -> a -> IO ()
datatype
creating and closing DMVars
newDMVar :: Binary a => String -> a -> IO (DMVar a)Source
Creates a new local DMVar with a start value. The string parameter specifies the name of the variable. If you leave it empty, a random value will be generated.
newEmptyDMVar :: Binary a => String -> IO (DMVar a)Source
Creates a new empty local DMVar. The string parameter specifies the name of the variable. If you leave it empty, a random value will be generated.
newRemoteDMVar :: String -> String -> IO (DMVar a)Source
Creates a reference to an external DMVar. The first parameter is the name of the resource and the second one the name of the node.
closeDMVar :: DMVar a -> IO ()Source
Closes a DMVar
acccessing DMVars
readDMVar :: Binary a => DMVar a -> IO aSource
Reads the content of a DMVar. Blocks if the Variable is empty. This may throw an exception if the owner of the variable is unreachable.