1
0
mirror of https://github.com/moshix/mvs.git synced 2026-01-17 08:32:54 +00:00

fixed concurrency some more

This commit is contained in:
Moshix 2017-06-24 22:31:57 -05:00
parent ca0f801c31
commit 289df884f1
2 changed files with 18 additions and 3 deletions

Binary file not shown.

View File

@ -9,15 +9,28 @@ import (
)
func ta(tamsec int) {
n := 0;
for i := 0; i < 9999999; i++ {
fmt.Println("Thread A: counter: ", i)
n++;
if n == 23 {
n = 0;
fmt.Println("\n\nThread A Thread B ");
fmt.Println("-------------- ---------------");
}
fmt.Println("A Counter: ", i)
time.Sleep(time.Duration(tamsec) * time.Millisecond)
}
}
func tb(tbmsec int) {
n := 0;
for i := 0; i < 9999999; i++ {
fmt.Println(" Thread B counter: ", i)
n++;
if n == 19 {
n = 0;
fmt.Println("\n\nThread A Thread B ");
fmt.Println("-------------- ---------------");
}
fmt.Println(" B Counter: ", i)
time.Sleep(time.Duration(tbmsec) * time.Millisecond)
}
}
@ -28,6 +41,8 @@ func timeoutfunc(t chan bool, toutsec int) {
func main() {
fmt.Println("Thread A Thread B ");
fmt.Println("-------------- ---------------");
var tamsec int = 300
var tbmsec int = 100
var toutsec int = 15