NRAO Home > CASA > CASA Toolkit Reference Manual
image.lock - Function

1.1.1 Acquire a lock on the image


Description

This function can be used to acquire a Read or a Read/Write lock on the image file. It is not of general user interest.

In general locking is handled automatically, with a built in lock release cycle. However, this function can be useful in scripts when a file is being shared between more than one process. See also functions unlock and haslock.

Arguments





Inputs

writelock

Acquire a read/write (T) or a readonly (F) lock

allowed:

bool

Default:

false

nattempts

Number of attempts, > 0. Default is unlimiited.

allowed:

int

Default:

0

Returns
bool

Example

 
 
"""  
#  
print "\t----\t lock Ex 1 \t----"  
ia.maketestimage(’xx’, overwrite=true)  
ia.lock(writelock=T)  
ia.unlock()  
ia.lock(writelock=F)  
ia.close(remove=true)  
#  
"""  
 
This acquires a read/write lock on the file. Then we unlock it  
and acquire a readonly lock.  

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search