Does the Python/C interface support Queue objects?

Fredrik Lundh fredrik at pythonware.com
Thu May 5 13:48:02 EDT 2005


"scott.manton at 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>






More information about the Python-list mailing list