Skip to content

Commit

Permalink
fix incompatibility with default value for UCI option CPU with some GUIs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenjlovell committed Feb 3, 2017
1 parent 3f2dc5a commit e5408ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/pkg/profile"
)

var version = "0.2.0"
var version = "0.2.1"

func max(a, b int) int {
if a > b {
Expand Down
10 changes: 6 additions & 4 deletions uci.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func (uci *UCIAdapter) identify() {
func (uci *UCIAdapter) option() { // option name option_name [ parameters ]
// tells the GUI which parameters can be changed in the engine.
uci.Send("option name Ponder type check default false\n")
uci.Send(fmt.Sprintf("option name CPU type spin default 0 min 1 max %d\n", runtime.NumCPU()))
numCPU := runtime.NumCPU()
uci.Send(fmt.Sprintf("option name CPU type spin default %d min 1 max %d\n", numCPU, numCPU))
}

// some example options from Toga 1.3.1:
Expand Down Expand Up @@ -311,10 +312,11 @@ func (uci *UCIAdapter) setOption(uciFields []string) {
uci.invalid(uciFields)
return
}
// fmt.Printf("setting up load balancer for %d CPU", numCPU)
if numCPU > 0 && runtime.NumCPU() > numCPU {
if numCPU > 0 && runtime.NumCPU() >= numCPU {
if uci.optionDebug {
uci.InfoString(fmt.Sprintf("setting up load balancer for %d CPU\n", numCPU))
}
setupLoadBalancer(numCPU)
// runtime.GC()
}
}
default:
Expand Down

0 comments on commit e5408ab

Please sign in to comment.