OpenSource For You

Waiting/blocking on an event

-

In real life scenarios, a process never waits without any event. The event can be a specified period before which the device is available for use. It could even be the arrival of data from some device such as the disk. Or the event could very well be waiting for some shared resource to be available. Since we don’t have any physical event to wait upon, let’s simulate the event by using a global variable flag. Shown below is the code snippet for this:

Newspapers in English

Newspapers from India