home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !SDL / man / SDL_CreateSemaphore.3 < prev    next >
Encoding:
Text File  |  2006-09-20  |  2.1 KB  |  63 lines

  1. <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
  2. <!-- available at http://polyglotman.sourceforge.net/ -->
  3.  
  4. <html>
  5. <head>
  6. <title>"SDL_CreateSemaphore"("3") manual page</title>
  7. </head>
  8. <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
  9. <a href='#toc'>Table of Contents</a><p>
  10.  
  11. <h2><a name='sect0' href='#toc0'>Name</a></h2>
  12. SDL_CreateSemaphore- Creates a new semaphore and assigns an initial
  13. value to it. 
  14. <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
  15. <p>
  16. <b>#include "SDL.h" #include "SDL_thread.h" <p>
  17. </b><b>SDL_sem *<b>SDL_CreateSemaphore</b></b>(<b>Uint32
  18. initial_value</b>); 
  19. <h2><a name='sect2' href='#toc2'>Description</a></h2>
  20. <p>
  21. <b>SDL_CreateSemaphore()</b> creates a new semaphore
  22. and initializes it with the value <b>initial_value</b>. Each locking operation
  23. on the semaphore by <i>SDL_SemWait</i>, <i>SDL_SemTryWait</i> or <i>SDL_SemWaitTimeout</i> will
  24. atomically decrement the semaphore value. The locking operation will be
  25. blocked if the semaphore value is not positive (greater than zero). Each
  26. unlock operation by <i>SDL_SemPost</i> will atomically increment the semaphore
  27. value. 
  28. <h2><a name='sect3' href='#toc3'>Return Value</a></h2>
  29. <p>
  30. Returns a pointer to an initialized semaphore or <b>NULL</b>
  31. if there was an error. 
  32. <h2><a name='sect4' href='#toc4'>Examples</a></h2>
  33. <p>
  34. <p>
  35. <br>
  36. <pre>CWSDL_sem *my_sem;
  37. my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE);
  38. if (my_sem == NULL) {
  39.         return CREATE_SEM_FAILED;
  40. }
  41. </pre><p>
  42.  
  43. <h2><a name='sect5' href='#toc5'>See Also</a></h2>
  44. <p>
  45. <i><b>SDL_DestroySemaphore</b></i>, <i><b>SDL_SemWait</b></i>, <i><b>SDL_SemTryWait</b></i>, <i><b>SDL_SemWaitTimeout</b></i>,
  46. <i><b>SDL_SemPost</b></i>, <i><b>SDL_SemValue</b></i> 
  47. <!--
  48.   
  49.  <p>
  50.  
  51. <hr><p>
  52. <a name='toc'><b>Table of Contents</b></a><p>
  53. <ul>
  54. <li><a name='toc0' href='#sect0'>Name</a></li>
  55. <li><a name='toc1' href='#sect1'>Synopsis</a></li>
  56. <li><a name='toc2' href='#sect2'>Description</a></li>
  57. <li><a name='toc3' href='#sect3'>Return Value</a></li>
  58. <li><a name='toc4' href='#sect4'>Examples</a></li>
  59. <li><a name='toc5' href='#sect5'>See Also</a></li>
  60. </ul>
  61. </body>
  62. </html>
  63.