|
Revision 1265, 1.5 kB
(checked in by ArcRiley, 6 months ago)
|
|
Pyrex 0.9.8.2 fixes :
- now requires 0.9.8.2
- nogil goes everywhere
- a few functions got GIL-cleaned
- still doesn't compile, but many steps closer
|
-
Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 | # PySoy AsyncQueue class |
|---|
| 2 | # |
|---|
| 3 | # Copyright (C) 2006,2007,2008 PySoy Group |
|---|
| 4 | # |
|---|
| 5 | # This program is free software; you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU Affero General Public License as published |
|---|
| 7 | # by the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # This program is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU Affero General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU Affero General Public License |
|---|
| 16 | # along with this program; if not, see http://www.gnu.org/licenses |
|---|
| 17 | # |
|---|
| 18 | # $Id$ |
|---|
| 19 | |
|---|
| 20 | cimport glib |
|---|
| 21 | cimport py |
|---|
| 22 | |
|---|
| 23 | cdef class AsyncQueue : |
|---|
| 24 | '''GLib AsyncQueue |
|---|
| 25 | |
|---|
| 26 | wrapped to allow ease of use by other PySoy classes. |
|---|
| 27 | ''' |
|---|
| 28 | |
|---|
| 29 | ############################################################################ |
|---|
| 30 | # |
|---|
| 31 | # Python functions |
|---|
| 32 | # |
|---|
| 33 | |
|---|
| 34 | def __cinit__(self) : |
|---|
| 35 | self._asyncqueue = glib.g_async_queue_new() |
|---|
| 36 | |
|---|
| 37 | def __dealloc__(self) : |
|---|
| 38 | glib.g_async_queue_unref(self._asyncqueue) |
|---|
| 39 | |
|---|
| 40 | ############################################################################ |
|---|
| 41 | # |
|---|
| 42 | # C functions |
|---|
| 43 | # |
|---|
| 44 | |
|---|
| 45 | cdef void _push(self, void* data) nogil : |
|---|
| 46 | glib.g_async_queue_push(self._asyncqueue, data) |
|---|
| 47 | |
|---|
| 48 | cdef object _pop(self) : |
|---|
| 49 | cdef void* _obj |
|---|
| 50 | with nogil: |
|---|
| 51 | _obj = glib.g_async_queue_pop(self._asyncqueue) |
|---|
| 52 | py.Py_DECREF(<object> _obj) |
|---|
| 53 | return <object> _obj |
|---|