- main calls Init
- Init creates barber subroutine
- barber subroutine starts 5 barber threads that wait for customers to arrive by channel
- barber subroutine waits for barbers to finish all customers via WaitGroup
- Init creates receptionist subroutine
- receptionist subroutine continues to parse a list of names randomly assigning a Style as it creates a Customer each time
- receptionist waits for ctx.Done() and continually sends newly created Customer objects to the customers channel
- Init creates barber subroutine
- main sleeps for a few seconds allowing customers to be created
- main sends cancel signal to ctx jobs
- receptionist quits
- barber threads finish their queue and send wg.Done to barber subroutine
- barber subroutine sends true to done channel
- main receives final done and exits
-
Notifications
You must be signed in to change notification settings - Fork 0
troby/ReceptionistAndBarber
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published