Does the Python/C interface support Queue objects?

Discussion in 'Python' started by scott.manton@gmail.com, May 5, 2005.

  1. Guest

    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.
     
    , May 5, 2005
    #1
    1. Advertising

  2. "" 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>
     
    Fredrik Lundh, May 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul L. Du Bois

    Queue.Queue-like class without the busy-wait

    Paul L. Du Bois, Mar 24, 2005, in forum: Python
    Replies:
    29
    Views:
    1,109
    Antoon Pardon
    Apr 4, 2005
  2. Russell Warren

    Is Queue.Queue.queue.clear() thread-safe?

    Russell Warren, Jun 22, 2006, in forum: Python
    Replies:
    4
    Views:
    719
    Russell Warren
    Jun 27, 2006
  3. Kceiw
    Replies:
    3
    Views:
    1,043
    Jim Langston
    Mar 14, 2006
  4. Gabriel Rossetti
    Replies:
    3
    Views:
    594
    Jerry Hill
    Apr 25, 2008
  5. Kris
    Replies:
    0
    Views:
    529
Loading...

Share This Page