Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 590 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 590 Bytes

Concurrency

package main

import (
    "time"
    "fmt"
    
    "github.com/golang-common-packages/concurrency"
)

func main() {
    func1 := func() {
            for char := 'a'; char < 'a' + 3; char++ {
                fmt.Printf("%c ", char)
            }
    }
    
    func2 := func() {
            for number := 1; number < 4; number++ {
                fmt.Printf("%d ", number)
            }
    }

    Con := &Concurrency.Concurrent{}
    
    Con.Parallelize(func1, func2)  // a 1 b 2 c 3
    
    Con.ParallelizeTimeout(time.Minute, func1, func2)  // a 1 b 2 c 3
}