home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3p / usinitsema.z / usinitsema
Encoding:
Text File  |  1998-10-20  |  3.3 KB  |  67 lines

  1.  
  2.  
  3.  
  4. UUUUSSSSIIIINNNNIIIITTTTSSSSEEEEMMMMAAAA((((3333PPPP))))                                                  UUUUSSSSIIIINNNNIIIITTTTSSSSEEEEMMMMAAAA((((3333PPPP))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      usinitsema - initialize a semaphore
  10.  
  11. CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<uuuulllloooocccckkkkssss....hhhh>>>>
  13.  
  14.      iiiinnnntttt uuuussssiiiinnnniiiittttsssseeeemmmmaaaa ((((uuuusssseeeemmmmaaaa____tttt ****sssseeeemmmmaaaa,,,, iiiinnnntttt vvvvaaaallll))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      _u_s_i_n_i_t_s_e_m_a initializes the semaphore specified by _s_e_m_a.  The count of the
  18.      semaphore is set to the value specified by _v_a_l. A value of 0 implies no
  19.      available resources, and the first process that attempts a 'P' operation
  20.      (via _u_s_p_s_e_m_a) will block.  This can be viewed as a synchronizing
  21.      semaphore, since the goal is to always have a process block until another
  22.      has completed an operation that the first process requires.  Positive
  23.      values for _v_a_l can be used for tracking a collection of resources.  The
  24.      simplest case of a value of 1 implements the common mutual exclusion
  25.      semaphore, namely one and only one process will be permitted through a
  26.      semaphore at a time.  Values greater than one imply that up to _v_a_l
  27.      resources may be simultaneously used, but requests for more than _v_a_l
  28.      resources cause the calling process to block until a resource comes free
  29.      (by a process holding a resource performing a _u_s_v_s_e_m_a).
  30.  
  31.      Metering and debugging are reinitialized and the history logging
  32.      mechanism is set according to the global setting (see _u_s_c_o_n_f_i_g(3P)).
  33.      _u_s_i_n_i_t_s_e_m_a should only be used for semaphores previously allocated using
  34.      either _u_s_n_e_w_s_e_m_a(3P) or _u_s_n_e_w_p_o_l_l_s_e_m_a(3P).  Note that _u_s_i_n_i_t_s_e_m_a does not
  35.      check whether any process is currently waiting for the semaphore.  Any
  36.      such information is lost.  This means that any processes that are waiting
  37.      for the semaphore (either blocked or queued on a pollable semaphore) will
  38.      not be woken, nor will the internal counts kept in the operating system
  39.      be reset.
  40.  
  41.      _u_s_i_n_i_t_s_e_m_a will fail if the following is true:
  42.  
  43.      [EINVAL]       _v_a_l must be greater than or equal to 0 and less than
  44.                     30000;
  45.  
  46. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  47.      uscpsema(3P), usctlsema(3P), usfreesema(3P), usinit(3P), usnewsema(3P),
  48.      usnewpollsema(3P), uspsema(3P), usvsema(3P).
  49.  
  50. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  51.      Upon successful completion, a value of 0 is returned. Otherwise, a value
  52.      of -1 is returned and _e_r_r_n_o is set to indicate the error.
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.