title: want semaphore to exceed SEM_VALUE_MAX
body: <p>I'm working on a program with critical sections, so I am using semaphores. Specifically, the POSIX semaphores: <a href="http://www.kernel.org/doc/man-pages/online/pages/man3/sem_close.3.html" rel="nofollow">http://www.kernel.org/doc/man-pages/online/pages/man3/sem_close.3.html</a></p>
  
  <p>According to <a href="http://www.sbin.org/doc/glibc/libc_34.html" rel="nofollow">http://www.sbin.org/doc/glibc/libc_34.html</a> (search: macro SEM_VALUE_MAX ), there is a maximum value that the general semaphore can be set to. On my system, this is about 32K. </p>
  
  <p>Unfortunately, I'm dealing with some time-sensitive code (reading form an arduino via a serial port at ~1MBit/s), so I'd like to have larger semaphores, because of some implementation details. Ideally, I'd like them to be able to be at least 2^20, but I'm a little unclear on why there is an upper limit anyway.</p>
  
  <p>Is there any way to exceed this SEM_VALUE_MAX, and get a semaphore with a larger value? I could only think of:</p>
  
  <ol>
  <li>Redefining SEM_VALUE_MAX 
  <ul>
  <li>probably a horrible idea; I think those POSIX folks know what they're doing</li>
  </ul></li>
  <li>Having a semaphore refer to more than one 'chunk' of data 
  <ul>
  <li>right now, each up() or down() only acquires/releases a single 'chunk' -- an unsigned short int.</li>
  <li>I imagine dealing with multiple at a time could cause deadlock.</li>
  </ul></li>
  <li>Implementing my own semaphores.
  <ul>
  <li>time consuming / redundant work</li>
  <li>less portable</li>
  </ul></li>
  <li>Ask you wonderful folks what you think!</li>
  </ol>
  
  <p>Thanks a bunch in advance!</p>