Author: DavidCzech Date: 2009-01-08 23:27:36 -0500 (Thu, 08 Jan 2009) New Revision: 1448
Modified: trunk/concordance/src/Core.c Log: Loop stuff Modified: trunk/concordance/src/Core.c =================================================================== --- trunk/concordance/src/Core.c 2009-01-09 03:50:28 UTC (rev 1447) +++ trunk/concordance/src/Core.c 2009-01-09 04:27:36 UTC (rev 1448) @@ -250,20 +250,27 @@ PyObject* tinput; PyObject* output; GString* popped; + GTimeVal* pop_end_time; /* ensure there are no arguments save self */ if (!PyArg_ParseTupleAndKeywords(args, kwds, ":__call__", kwlist)) return NULL; - + + g_get_current_time(pop_end_time); + g_time_val_add(pop_end_time,10000); + /* continuous loop */ - while (TRUE) { + while ( PyErr_CheckSignals() == 0 ) { /* release the GIL while waiting for the next callback gpointer g_async_queue_pop (GAsyncQueue *queue); */ + Py_BEGIN_ALLOW_THREADS - popped = g_async_queue_pop(self->queueRecv); + popped = g_async_queue_timed_pop(self->queueRecv,pop_end_time); Py_END_ALLOW_THREADS + + if (popped){ /* build argument tuple @@ -298,11 +305,10 @@ Py_DECREF(tinput); Py_DECREF(sinput); g_string_free(popped, TRUE); + } } - /* this should never be reached */ - Py_INCREF(Py_None); - return Py_None; + return NULL; } /* _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn