Rubrik | Phone
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2020-10-26Added By Anonymous
Source: Link
Design a class, which contains two methods, schedule() and waitUntilComplete(), when user wanna excecute a work, will call schedule() (schedule() method will returns immediately), The function of waitUntilComplete is to wait for all the existing work to be executed, and then return. Because is muti-thread, need to consider thread safe.