// Getall retrieves the values of all the semaphores in the set func (ss *SemaphoreSet) Getall() ([]uint16, error) { carr := make([]C.ushort, ss.count) rc, err := C.semctl_arr(C.int(ss.id), C.GETALL, &carr[0]) if rc == -1 { return nil, err } results := make([]uint16, ss.count) for i, ci := range carr { results[i] = uint16(ci) } return results, nil }
// Setall sets the values of every semaphore in the set func (ss *SemaphoreSet) Setall(values []uint16) error { if uint(len(values)) != ss.count { return errors.New("sysvipc: wrong number of values for Setall") } carr := make([]C.ushort, ss.count) for i, val := range values { carr[i] = C.ushort(val) } rc, err := C.semctl_arr(C.int(ss.id), C.SETALL, &carr[0]) if rc == -1 { return err } return nil }