March 2019
Intermediate to advanced
336 pages
9h 9m
English
The passenger methods starts and ends passenger movement to the queue. The passenger method invokes the StartPass method, and the EndPass method ends after sleep calls for 10 seconds and two seconds. The passenger moves into the queue and reaches the ticket counter, as shown in the following code:
//passenger method starts and ends the pass Queuefunc passenger(Queue *Queue) { //fmt.Println("starting the passenger Queue") for { // fmt.Println("starting the processing") // Sleep up to 10 seconds. time.Sleep(time.Duration(rand.Intn(10000)) * time.Millisecond) Queue.StartPass() fmt.Println(" Passenger starts") // Sleep up to 2 seconds. time.Sleep(time.Duration(rand.Intn(2000)) * time.Millisecond) fmt.Println( " Passenger ...Read now
Unlock full access