Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /usr/share/gap/doc/hpc/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : //usr/share/gap/doc/hpc/chap8.txt

  
  8 Semaphores
  
  
  8.1 Semaphores
  
  Semaphores  are  synchronized  counters;  they  can also be used to simulate
  locks.
  
  8.1-1 CreateSemaphore
  
  CreateSemaphore( [value] )  function
  
  The  function  CreateSemaphore takes an optional argument, which defaults to
  zero. It is the counter with which the semaphore is initialized.
  
    Example  
    gap> sem := CreateSemaphore(1);
    <semaphore 0x1108e81c0: count = 1>
  
  
  8.1-2 WaitSemaphore
  
  WaitSemaphore( sem )  function
  
  WaitSemaphore  receives  a  previously created semaphore as its argument. If
  the  semaphore's counter is greater than zero, it decrements the counter and
  returns;  if the counter is zero, it waits until another thread increases it
  via SignalSemaphore (8.1-3), then decrements the counter and returns.
  
    Example  
    gap> sem := CreateSemaphore(1);
    <semaphore 0x1108e81c0: count = 1>
    gap> WaitSemaphore(sem);
    gap> sem;
    <semaphore 0x1108e81c0: count = 0>
  
  
  8.1-3 SignalSemaphore
  
  SignalSemaphore( sem )  function
  
  SignalSemaphore  receives a previously created semaphore as its argument. It
  increments the semaphore's counter and returns.
  
    Example  
    gap> sem := CreateSemaphore(1);
    <semaphore 0x1108e81c0: count = 1>
    gap> WaitSemaphore(sem);
    gap> sem;
    <semaphore 0x1108e81c0: count = 0>
    gap> SignalSemaphore(sem);
    gap> sem;
    <semaphore 0x1108e81c0: count = 1>
  
  
  
  8.1-4 Simulating locks
  
  In  order  to  use  semaphores to simulate locks, create a semaphore with an
  initial  value  of  1.  WaitSemaphore  (8.1-2)  is then equivalent to a lock
  operation, SignalSemaphore (8.1-3) is equivalent to an unlock operation.
  

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net