hg.3 (2010 09)

h
hg(3) hg(3)
(Mercury Library)
critical region
release lock
hg_setcrit(CRIT_OFF, WILLING_TO_BLOCK);
Or ...
hg_setcrit(lock_address , WILLING_TO_BLOCK);
acquire lock
critical region
release lock
hg_setcrit(CRIT_OFF, WILLING_TO_BLOCK);
It is never absolutely necessary to set WILLING_TO_BLOCK
, but it reduces your chances of being
switched out during the critical region. Remember that
WILLING_TO_BLOCK means that you are wil-
ling to block during the
hg_setcrit() call, not during the critical region.
Note
All information returned by the initiative should be considered hints. By their very nature, and the
nature of scheduling user processes and threads, much of this information can theoretically be stale
immediately after its delivery to the user, or at any time after that. User code must take this into account
in its design.
The
libpthread library links with the Mercury Library in order to decide on the scheduling of threads
at any point of time. Hence, applications which are using both, libpthread and libhg need to take
care that libpthread is already using libhg for scheduling decisions. The applications may still how-
ever use the Mercury APIs if they feel the need to do so.
WARNINGS
Remember that this thread information may be stale any time after the kernel post it. Be careful how
you rely on it. It is totally up to the user code to take care of this while writing code.
AUTHOR
The Mercury APIs were developed by Hewlett-Packard Company.
SEE ALSO
pthread(3T), pthread_attr_setscope(3T).
HP-UX 11i Version 3: September 2010 5 Hewlett-Packard Company 5