|
5.1.120 status
-
Syntax:
status ( link_expression, string_expression )
-
Type:
string
-
Syntax:
status ( link_expression, string_expression, string_expression )
status ( link_expression, string_expression, string_expression, int_expression )
-
Type:
int
-
Purpose:
returns the status of the link as asked for by the second argument. If
a third argument is given, the result of the comparison to the status
string is returned: (status(l,s1)==s2) is equivalent to
status(l,s1,s2) . If a fourth integer argument (say, i ) is
given and if status(l,s1,s2) yields 0 , then the execution
of the current process is suspended (the process is put to “sleep”)
for approximately i microseconds, and afterwards the result of another
call to status(l,s1,s2) is returned. The latter is useful for
“polling” the read status of MPtcp links such that busy
loops are avoided (see Parallelization with MPtcp links for an
example). Note that on some systems, the minimum time for a process to
be put to sleep is one second.
The following string expressions are allowed:
-
"name"
the name string given by the definition of the link (usually the filename)
-
"type"
returns "ASCII" , "MPfile" , "MPtcp" or "DBM"
-
"open"
returns "yes" or "no"
-
"openread"
returns "yes" or "no"
-
"openwrite"
returns "yes" or "no"
-
"read"
returns "ready" or "not ready"
-
"write"
returns "ready" or "not ready"
-
"mode"
returns (depending on the type of the link and its status)
"","w","a","r" or "rw"
-
Example:
| link l=":w example.txt";
status(l,"write");
→ not ready
open(l);
status(l,"write","ready");
→ 1
close(l);
|
See
link;
open;
read;
write.
|