shm

package module
v0.0.0-...-fc0692e Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 6 Imported by: 0

README

SHM

shm is Golang shared memory library.

Example

w, _ := shm.Create("shm_name", 256)
defer w.Close()

r, _ := shm.Open("shm_name", 256)
defer r.Close()

wbuf := []byte("Hello World")
w.Write(wbuf)

rbuf := make([]byte, len(wbuf))
r.Read(rbuf)
// Now rbuf == wbuf

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory is shared memory struct

func Create

func Create(name string, size int32) (*Memory, error)

Create is create shared memory

func Open

func Open(name string, size int32) (*Memory, error)

Open is open exist shared memory

func (*Memory) Close

func (o *Memory) Close() (err error)

Close is close & discard shared memory

func (*Memory) Read

func (o *Memory) Read(p []byte) (n int, err error)

Read is read shared memory (current position)

func (*Memory) ReadAt

func (o *Memory) ReadAt(p []byte, off int32) (n int, err error)

ReadAt is read shared memory (offset)

func (*Memory) ReadInt16

func (o *Memory) ReadInt16() (n int16, err error)

Read an int16 from shared memory

func (*Memory) ReadInt32

func (o *Memory) ReadInt32() (n int32, err error)

Read an int32 from shared memory

func (*Memory) ReadInt64

func (o *Memory) ReadInt64() (n int64, err error)

Read an int64 from shared memory

func (*Memory) ReadInt8

func (o *Memory) ReadInt8() (n int8, err error)

Read an int8 from shared memory

func (*Memory) ReadString

func (o *Memory) ReadString() (n string, err error)

Read an string from shared memory

func (*Memory) ReadUint16

func (o *Memory) ReadUint16() (n uint16, err error)

Read an uint16 from shared memory

func (*Memory) ReadUint32

func (o *Memory) ReadUint32() (n uint32, err error)

Read an uint32 from shared memory

func (*Memory) ReadUint64

func (o *Memory) ReadUint64() (n uint64, err error)

Read an uint64 from shared memory

func (*Memory) ReadUint8

func (o *Memory) ReadUint8() (n uint8, err error)

Read an uint8 from shared memory

func (*Memory) Seek

func (o *Memory) Seek(offset int32, whence int) (int32, error)

Seek is move read/write position at shared memory

func (*Memory) Write

func (o *Memory) Write(p []byte) (n int, err error)

Write is write shared memory (current position)

func (*Memory) WriteAt

func (o *Memory) WriteAt(p []byte, off int32) (n int, err error)

WriteAt is write shared memory (offset)

func (*Memory) WriteInt16

func (o *Memory) WriteInt16(p int16) (err error)

Writes an int16 to shared memory

func (*Memory) WriteInt32

func (o *Memory) WriteInt32(p int32) (err error)

Writes an int32 to shared memory

func (*Memory) WriteInt64

func (o *Memory) WriteInt64(p int64) (err error)

Writes an int64 to shared memory

func (*Memory) WriteInt8

func (o *Memory) WriteInt8(p int8) (err error)

Writes an int8 to shared memory

func (*Memory) WriteString

func (o *Memory) WriteString(p string) (err error)

Writes an string to shared memory

func (*Memory) WriteUint16

func (o *Memory) WriteUint16(p uint16) (err error)

Writes an uint16 to shared memory

func (*Memory) WriteUint32

func (o *Memory) WriteUint32(p uint32) (err error)

Writes an uint32 to shared memory

func (*Memory) WriteUint64

func (o *Memory) WriteUint64(p uint64) (err error)

Writes an uint64 to shared memory

func (*Memory) WriteUint8

func (o *Memory) WriteUint8(p uint8) (err error)

Writes an uint8 to shared memory

Jump to

Keyboard shortcuts

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