Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / colonet / server / vision / php_sysvsem.h @ 1428

History | View | Annotate | Download (1.91 KB)

1
/* 
2
   +----------------------------------------------------------------------+
3
   | PHP Version 5                                                        |
4
   +----------------------------------------------------------------------+
5
   | Copyright (c) 1997-2008 The PHP Group                                |
6
   +----------------------------------------------------------------------+
7
   | This source file is subject to version 3.01 of the PHP license,      |
8
   | that is bundled with this package in the file LICENSE, and is        |
9
   | available through the world-wide-web at the following url:           |
10
   | http://www.php.net/license/3_01.txt                                  |
11
   | If you did not receive a copy of the PHP license and are unable to   |
12
   | obtain it through the world-wide-web, please send a note to          |
13
   | license@php.net so we can mail you a copy immediately.               |
14
   +----------------------------------------------------------------------+
15
   | Author: Tom May <tom@go2net.com>                                     |
16
   +----------------------------------------------------------------------+
17
*/
18

    
19
/* $Id: php_sysvsem.h,v 1.16.2.1.2.2 2007/12/31 07:20:13 sebastian Exp $ */
20

    
21
#ifndef PHP_SYSVSEM_H
22
#define PHP_SYSVSEM_H
23

    
24
#include <stdexcept>
25
#include <string>
26

    
27
struct sysvsem_error : public std::runtime_error
28
{
29
    sysvsem_error(const std::string& msg) : runtime_error(msg){}
30
};
31

    
32
class sysvsem {
33
private:
34
        //int id;                                                /* For error reporting. */
35
        int key;                                        /* For error reporting. */
36
        int semid;                                        /* Returned by semget(). */
37
        int count;                                        /* Acquire count for auto-release. */
38
        int auto_release;                        /* flag that says to auto-release. */
39

    
40
        int php_sysvsem_semop(int acquire);
41
        
42
public:
43
        sysvsem(long key, long max_acquire = 1, long perm = 0666, long auto_release = 1) throw (sysvsem_error);
44
        ~sysvsem();
45
        int sem_acquire();
46
        int sem_release();
47
        int sem_remove();
48
};
49

    
50
#endif /* PHP_SYSVSEM_H */