mirror of
https://github.com/samuelncui/acp.git
synced 2025-12-23 13:15:16 +00:00
32 lines
488 B
Go
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
|
|
}
|
|
}
|