Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 792 Bytes

File metadata and controls

29 lines (21 loc) · 792 Bytes

Listing E.1: A sequential function

Code in the file

Tip

Click the links to see the file and its directory in their original locations and state as they were at the time of the listing.

package main

import (
	"fmt"
	"math/rand/v2"
	"time"
)

func work(id int) {
	time.Sleep(rand.N(10 * time.Second))
	fmt.Printf("worker %d done.", id)
}

func main() {
	work(1)
	fmt.Print("main done.")
}