-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine.go
41 lines (33 loc) · 786 Bytes
/
engine.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package engine
import (
"runtime"
"sync"
"time"
)
const VERSION = "mumax3.5.1"
var UNAME = VERSION + " " + runtime.GOOS + "_" + runtime.GOARCH + " " + runtime.Version() + " (" + runtime.Compiler + ")"
var StartTime = time.Now()
var (
busyLock sync.Mutex
busy bool // are we so busy we can't respond from run loop? (e.g. calc kernel)
)
// We set SetBusy(true) when the simulation is too busy too accept GUI input on Inject channel.
// E.g. during kernel init.
func SetBusy(b bool) {
busyLock.Lock()
defer busyLock.Unlock()
busy = b
}
func GetBusy() bool {
busyLock.Lock()
defer busyLock.Unlock()
return busy
}
// Cleanly exits the simulation, assuring all output is flushed.
func Close() {
drainOutput()
Table.flush()
if logfile != nil {
logfile.Close()
}
}