Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data SharedPtr a
- toSharedPtr :: Allocator -> Ptr a -> SharedPtr a
- fromSharedPtr :: Allocator -> SharedPtr a -> Ptr a
- type Allocator = Ptr AllocatorT
- createAllocator :: IO Allocator
- lookupAllocator :: SOName Allocator -> IO Allocator
- destroyAllocator :: Allocator -> IO ()
- withNewAllocator :: (Allocator -> IO a) -> IO a
- withAllocator :: SOName Allocator -> (Allocator -> IO a) -> IO a
- allocStoreName :: Allocator -> SOName Allocator
- malloc :: Storable a => Allocator -> IO (Ptr a)
- mallocBytes :: Allocator -> Int -> IO (Ptr a)
- realloc :: Allocator -> Ptr a -> Int -> IO (Ptr a)
- free :: Allocator -> Ptr a -> IO ()
Documentation
Special pointer format to pass between memory spaces of processes.
Instances
toSharedPtr :: Allocator -> Ptr a -> SharedPtr a Source #
Make a portable shared pointer out of a regular pointer.
The result can be transfered to another process and re-created using
the shared Allocator
.
fromSharedPtr :: Allocator -> SharedPtr a -> Ptr a Source #
Reconstruct a regular pointer from a portable shared pointer.
Returns NULL
if shared pointer or allocator are not valid.
type Allocator = Ptr AllocatorT Source #
Opaque pointer to the allocator type defined in C
code.
lookupAllocator :: SOName Allocator -> IO Allocator Source #
Lookup a Allocator
by its name.
Use this to share one allocator between multiple processes.
destroyAllocator :: Allocator -> IO () Source #
Destroy allocator instance. Note: memory is fully unlinked and released only after the last allocator sharing the memory is destroyed.