chenshijun
2020-03-30 aaae67dd2273659da5473cb43a4e0cf5d6f54316
增加一些资源释放方面的处理
1个文件已修改
8 ■■■■ 已修改文件
shmwrap.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
shmwrap.go
@@ -11,13 +11,13 @@
func NewBlock(size int, key int) ([]byte, int, error) {
    id, err := shm.Get(key, size, shm.IPC_CREAT|0666)
    if err != nil || id == -1 {
        fmt.Println("NewBlock Get:", key, err)
        fmt.Printf("NewBlock Get:%x, %v\n", key, err)
        return nil, -1, err
    }
    data, err2 := shm.At(id, 0, 0)
    if err2 != nil {
        fmt.Println("NewBlock At:", key, err2)
        fmt.Printf("NewBlock At:%x, %v\n", key, err2)
        return nil, -1, err2
    }
@@ -28,13 +28,13 @@
func AttachBlock(key int) ([]byte, int, error) {
    id, err := shm.Get(key, 0, 0)
    if err != nil || id == -1 { //no exist
        fmt.Println("AttachBlock Get:", key, err)
        fmt.Printf("AttachBlock Get:%x, %v\n", key, err)
        return nil, -1, err
    }
    data, err2 := shm.At(id, 0, 0)
    if err2 != nil {
        fmt.Println("AttachBlock At:", key, err2)
        fmt.Printf("AttachBlock Get:%x, %v\n", key, err2)
        return nil, -1, err2
    }