context.pxd revision 781d71db
1"""0MQ Context class declaration."""
2
3#
4#    Copyright (c) 2010-2011 Brian E. Granger & Min Ragan-Kelley
5#
6#    This file is part of pyzmq.
7#
8#    pyzmq is free software; you can redistribute it and/or modify it under
9#    the terms of the Lesser GNU General Public License as published by
10#    the Free Software Foundation; either version 3 of the License, or
11#    (at your option) any later version.
12#
13#    pyzmq is distributed in the hope that it will be useful,
14#    but WITHOUT ANY WARRANTY; without even the implied warranty of
15#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16#    Lesser GNU General Public License for more details.
17#
18#    You should have received a copy of the Lesser GNU General Public License
19#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20#
21
22#-----------------------------------------------------------------------------
23# Code
24#-----------------------------------------------------------------------------
25
26cdef class Context:
27
28    cdef object __weakref__     # enable weakref
29    cdef void *handle           # The C handle for the underlying zmq object.
30    cdef bint _shadow           # whether the Context is a shadow wrapper of another
31    cdef void **_sockets        # A C-array containg socket handles
32    cdef size_t _n_sockets      # the number of sockets
33    cdef size_t _max_sockets    # the size of the _sockets array
34    cdef int _pid               # the pid of the process which created me (for fork safety)
35    
36    cdef public bint closed   # bool property for a closed context.
37    cdef inline int _term(self)
38    # helpers for events on _sockets in Socket.__cinit__()/close()
39    cdef inline void _add_socket(self, void* handle)
40    cdef inline void _remove_socket(self, void* handle)
41
42