Blocking a procedure

Raphael Collet raph at info.ucl.ac.be
Thu Mar 29 10:53:48 CEST 2007


Lavanya r wrote:
> Respected members,
> 
>            I have encountered a problem in blocking a certain process in 
> the server until the client generates a file.
> For Example, in the command  I={New Open.file 
> init(name:'C:/Inetpub/wwwroot/info.txt' flags:[read])}, the file ' 
> info.txt' is made available only by the client code. As the server has 
> to be run first,should it be suspended for a while till the client runs? 
> What command must be used for enabling this?Please help me out with this.

You can block a thread on the server by making it wait for a variable 
that is bound only when the client is ready.

	declare ClientReady in     % use a 'local' if needed

	thread
	   {Wait ClientReady}
	   I={New Open.file init(...)}
	   %% file processing code here
	end

When the client is ready, simply run

	ClientReady=unit

This could be triggered by the client sending a message.  Another 
possibility is to give the client access to the variable ClientReady, 
and let the client bind the variable when it is ready.

Cheers,
raph


More information about the mozart-users mailing list