kalliopi
asked on
Waiting On A Semiphore (semifore??)
It's a pretty simple question...
How do I wait on a semiphore in DELPHI?
How do I wait on a semiphore in DELPHI?
The semifore (traffic light) may be simple boolean variable. When you waiting for it changed you need to give an ability to application to continue its work.
------
var Semifore : boolean;
procedure WaitForSemifore;
begin
while not Semiphore
do Application.ProcessMessage s; // or Application.HandleMessage
end;
----
Igor.
------
var Semifore : boolean;
procedure WaitForSemifore;
begin
while not Semiphore
do Application.ProcessMessage
end;
----
Igor.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Mike,
Thanx. That was exactly what I was looking for. I've had to use "while true Application.ProcessMessage s and it's just killing my CPU time. Thanx much. That's great.
Thanx. That was exactly what I was looking for. I've had to use "while true Application.ProcessMessage
Yup :-)
This might be easy - or difficult. To answer this question we need more information....
For example a "file semaphore":
One program writes a file (can be empty, but can contain information, too) when starting a specific operation. All other programs now know that this operation is in progress (and they are not allowed to interfere at the moment). If the program is ready, the file is deletet.
This is only ONE example of thousands for the use of semaphores. The range of usage goes from Database programming to the windows multitasking core itself and from files to registers...
On what kind of semaphore (I still think, you mean this) do you want to wait???
greetz
Carsten