Richard Tew ha scritto:
On Sun, Jun 29, 2008 at 7:24 AM, Alberto Ganesh Barbati
<[EMAIL PROTECTED]> wrote:
in the C API there are a PyChannel_GetClosing and a PyChannel_GetClosed
functions, however I couldn't find any PyChannel_Close or PyChannel_Open
function. Was that an oversight? If not, how is a channel supposed to be
closed/reopened with the C API?
You are the first person I have heard of who actually closes or opens
channels :-)
Really? It seems such a useful feature to me... :)
If you want the API changed in the near future, you could submit a
patch. Otherwise, it may get done next week when we are hoping plan
to port Stackless to Python 3000. Kristjan Valur is flying over to
the CCP North America offices in Stone Mountain, Georgia to join me
for this from the 7th - 11th July. If anyone else wishes to join us
for this week and work on Stackless, feel free to email me and we'll
talk.
Here's the patch:
--- stackless-2.52\Stackless\stackless_api.h_ 14/05/2007 17.59.12
+++ stackless-2.52\Stackless\stackless_api.h 01/07/2008 11.40.08
@@ -235,244 +235,250 @@
/* 1 = soft switched 0 = hard switched -1 = failure */
/* the next tasklet in the queue or None */
PyAPI_FUNC(PyObject *) PyChannel_GetQueue(PyChannelObject *self);
+/* close() the channel */
+PyAPI_FUNC(void) PyChannel_Close(PyChannelObject *self);
+
+/* open() the channel */
+PyAPI_FUNC(void) PyChannel_Open(PyChannelObject *self);
+
/* whether close() was called */
PyAPI_FUNC(int) PyChannel_GetClosing(PyChannelObject *self);
/* closing, and the queue is empty */
--- stackless-2.52\Stackless\module\channelobject.c_ 09/01/2008 22.13.34
+++ stackless-2.52\Stackless\module\channelobject.c 01/07/2008 11.39.00
@@ -878,897 +878,909 @@
Py_INCREF(Py_None);
return Py_None;
}
+void
+PyChannel_Close(PyChannelObject *self)
+{
+ self->flags.closing = 1;
+}
+
static char channel_open__doc__[] =
"channel.open() -- reopen a channel. See channel.close.";
static PyObject *
channel_open(PyChannelObject *self)
{
self->flags.closing = 0;
Py_INCREF(Py_None);
return Py_None;
+}
+
+void
+PyChannel_Open(PyChannelObject *self)
+{
+ self->flags.closing = 0;
}
static char channel_reduce__doc__[] =
"channel.__reduce__() -- currently does not distinguish threads.";
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless