Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Does the Python/C interface support Queue objects?

Reply
Thread Tools

Does the Python/C interface support Queue objects?

 
 
scott.manton@gmail.com
Guest
Posts: n/a
 
      05-05-2005
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.

 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      05-05-2005
"(E-Mail Removed)" 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>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program blocked in Queue.Queue.get and Queue.Queue.put Kris Python 0 01-04-2012 03:46 PM
why does the following with Queue, q.put('\x02', True) not put itin the queue? Gabriel Rossetti Python 3 04-25-2008 03:41 PM
Is Queue.Queue.queue.clear() thread-safe? Russell Warren Python 4 06-27-2006 03:03 PM
what's the difference between #include "queue.h" and #include "queue.cpp" Kceiw C++ 3 03-14-2006 03:01 AM
Queue.Queue-like class without the busy-wait Paul L. Du Bois Python 29 04-04-2005 01:28 PM



Advertisments