shm

package module
v0.0.0-...-7207ca9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

README

shm-go

GoDoc

A high-performance shared memory communications library for Go.

Download

go get github.com/tmthrgd/shm-go

License

Unless otherwise noted, the shm-go source files are distributed under the Modified BSD License found in the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSharedMemory = errors.New("invalid shared memory")
	ErrNotMultipleOf64     = errors.New("blockSize is not a multiple of 64")
	ErrInvalidBuffer       = errors.New("invalid buffer")
)

Functions

func Unlink(name string) error

Unlink removes the previously created blocker.

Taken from shm_unlink(3):

The  operation  of shm_unlink() is analogous to unlink(2): it removes a
shared memory object name, and, once all processes  have  unmapped  the
object, de-allocates and destroys the contents of the associated memory
region.  After a successful shm_unlink(),  attempts  to  shm_open()  an
object  with  the same name will fail (unless O_CREAT was specified, in
which case a new, distinct object is created).

Types

type Buffer

type Buffer struct {
	Data  []byte
	Flags *[blockFlagsSize]byte
	// contains filtered or unexported fields
}

type ReadWriteCloser

type ReadWriteCloser struct {

	// Must be accessed using atomic operations
	Flags *[sharedFlagsSize]uint32
	// contains filtered or unexported fields
}

func CreateDuplex

func CreateDuplex(name string, perm os.FileMode, blockCount, blockSize int) (*ReadWriteCloser, error)

func CreateSimplex

func CreateSimplex(name string, perm os.FileMode, blockCount, blockSize int) (*ReadWriteCloser, error)

func OpenDuplex

func OpenDuplex(name string) (*ReadWriteCloser, error)

func OpenSimplex

func OpenSimplex(name string) (*ReadWriteCloser, error)

func (*ReadWriteCloser) Close

func (rw *ReadWriteCloser) Close() error

func (*ReadWriteCloser) GetReadBuffer

func (rw *ReadWriteCloser) GetReadBuffer() (Buffer, error)

func (*ReadWriteCloser) GetWriteBuffer

func (rw *ReadWriteCloser) GetWriteBuffer() (Buffer, error)

func (*ReadWriteCloser) Name

func (rw *ReadWriteCloser) Name() string

Name returns the name of the shared memory.

func (*ReadWriteCloser) Read

func (rw *ReadWriteCloser) Read(p []byte) (n int, err error)

func (*ReadWriteCloser) ReadFrom

func (rw *ReadWriteCloser) ReadFrom(r io.Reader) (n int64, err error)

func (*ReadWriteCloser) SendReadBuffer

func (rw *ReadWriteCloser) SendReadBuffer(buf Buffer) error

func (*ReadWriteCloser) SendWriteBuffer

func (rw *ReadWriteCloser) SendWriteBuffer(buf Buffer) (n int, err error)
func (rw *ReadWriteCloser) Unlink() error

Unlink removes the shared memory.

It is the equivalent to calling Unlink(string) with the same name as Create* or Open*.

Taken from shm_unlink(3):

The  operation  of shm_unlink() is analogous to unlink(2): it removes a
shared memory object name, and, once all processes  have  unmapped  the
object, de-allocates and destroys the contents of the associated memory
region.  After a successful shm_unlink(),  attempts  to  shm_open()  an
object  with  the same name will fail (unless O_CREAT was specified, in
which case a new, distinct object is created).

func (*ReadWriteCloser) Write

func (rw *ReadWriteCloser) Write(p []byte) (n int, err error)

func (*ReadWriteCloser) WriteTo

func (rw *ReadWriteCloser) WriteTo(w io.Writer) (n int64, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL