Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does the Python/C interface support Queue objects?

2 views
Skip to first unread message

scott....@gmail.com

unread,
May 5, 2005, 12:07:16 PM5/5/05
to
I'm a new user of the Python C interface. I would like to know if it
is possible to put items on a standard python Queue object in C, and
pop them from Python. Does the Python/C interface support Queue
objects?

A little background. I made a C dll that sets up a thread for
collecting data from an NI data aquisition card. The thread builds a
list and passes the list to to python via a callback, then python puts
them in the Queue. I would prefer to put the data in the Queue from
the C thread for efficiency, and then monitor the Queue from python.

Fredrik Lundh

unread,
May 5, 2005, 1:48:02 PM5/5/05
to pytho...@python.org
"scott....@gmail.com" wrote:

> A little background. I made a C dll that sets up a thread for
> collecting data from an NI data aquisition card. The thread builds a
> list and passes the list to to python via a callback, then python puts
> them in the Queue. I would prefer to put the data in the Queue from
> the C thread for efficiency, and then monitor the Queue from python.

the Queue type is implemented in Python, so you won't gain much by
skipping the callback.

but if you insist, you can use the abstract API to manipulate the queue
object:

http://docs.python.org/api/object.html

res = PyObject_CallMethod(queue, "put", "O", object);
... check error status ...
Py_DECREF(res);

</F>

0 new messages