Perl Programming Documentation
Download Perl
Explore

Manual

- Overview
- Tutorials
- FAQs
- History / Changes
- License

Reference

- Language
- Functions
- Operators
- Special Variables
- Pragmas
- Utilities
- Internals
- Platform Specific

Modules

- A • B • C • D • E
- F • G • H • I • L
- M • N • O • P • S
- T • U • X

Tools

- Preferences

# semop

Perl 5 version 16.0 documentation
Go to top
Show recent pages
Recently read

# semop

Perl functions A-Z | Perl functions by category | The 'perlfunc' manpage

- semop KEY,OPSTRING

  Calls the System V IPC function semop(2) for semaphore operations such as signalling and waiting. OPSTRING must be a packed array of semop structures. Each semop structure can be generated with `pack("s!3", $semnum, $semop, $semflag)` . The length of OPSTRING implies the number of semaphore operations. Returns true if successful, false on error. As an example, the following code waits on semaphore $semnum of semaphore id $semid:

          $semop = pack("s!3", $semnum, -1, 0);    die "Semaphore trouble: $!\n" unless semop($semid, $semop);

  To signal the semaphore, replace `-1` with `1` . See also SysV IPC in perlipc, `IPC::SysV` , and `IPC::SysV::Semaphore` documentation.

  Portability issues: semop in perlport.