| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

semaph_lookup

#include "smtlib.h"
SEMAPH *
semaph_lookup (
    const char *semaph_name             /*  Name of semaph to look for       */
)

Synopsis

Checks whether a specific semaphore exists; returns the address of the semaphore information block, or NULL if there was an error, setting smt_errno to one of these values:
SMT NOTREADY smt_init() was not called, or failed
SMT NOSUCHSEMAPH Specified semaphore was not declared

Source Code - (smtlib.c)

{
    SYMBOL  *dict_entry;                /*  Dictionary symbol                */

#if (defined (SMT_TRACE))
    trace ("semaph_lookup: semaph=%s", semaph_name);
#endif
    if (!smt_alive)                     /*  If SMT API was not correctly     */
      {                                 /*    initialised, forget it         */
        smt_errno = SMT_NOTREADY;
        return (NULL);
      }

    dict_entry = sym_lookup_symbol (dict, get_semaph_name (semaph_name));
    if (dict_entry == NULL)
      {
         smt_errno = SMT_NOSUCHSEMAPH;
         return (NULL);
      }
    return (dict_entry-> data);         /*  Return pointer to SEMAPH         */
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation