Skip to content

Files

Latest commit

Nov 25, 2024
930a2de · Nov 25, 2024

History

History

06-select-timeout

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 25, 2024
Nov 25, 2024
Loading
sequenceDiagram
    participant M as Main
    participant S as Sender(goroutine)
    participant C as Channel
    participant T as Time.After
    
    M->>S: Start sender goroutine
    activate S
    S-->>M: Return channel
    
    loop Until timeout
        S->>C: Send message (i)
        S->>S: Sleep random time
        alt Message Available
            C->>M: Receive message
            M->>M: Print message
        else 5s Timeout
            T->>M: Timeout signal
            M->>M: Print "no response"
            M->>M: return
        end
    end