Top
Back: sres
Forward: std
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.136 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", "DBM" or "ssi"
"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"
"exists"
returns "yes" or "no": existence of the filename for ASCII/MPfile/ssi links
Example:
 
See link; open; read; write.

Top Back: sres Forward: std FastBack: Functions and system variables FastForward: Control structures Up: Functions Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 3-1-6, Dec 2012, generated by texi2html.