Files
acp/opt_device.go
2022-12-07 19:50:48 +08:00

32 lines
488 B
Go

package acp
type deviceOption struct {
linear bool
threads int
}
func (do *deviceOption) check() {
if do.threads == 0 {
do.threads = 8
}
if do.linear {
do.threads = 1
}
}
type DeviceOption func(*deviceOption) *deviceOption
func LinearDevice(b bool) DeviceOption {
return func(d *deviceOption) *deviceOption {
d.linear = b
return d
}
}
func DeviceThreads(threads int) DeviceOption {
return func(d *deviceOption) *deviceOption {
d.threads = threads
return d
}
}