- Fixed test-pyloader

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@791 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-07-22 14:47:39 +00:00
parent 5e40f9a8c1
commit 66a2d414f2
2 changed files with 17 additions and 1 deletions

View File

@ -82,6 +82,19 @@ class ScriptAdapter :
self._ret_val = self._policy.is_preemptive()
self._g_mutex.unlock()
## @brief Asynchronously call Policy.get_time_slice()
#
# @param self The caller object
def async_get_time_slice(self):
self._g_mutex.lock(ScriptAdapter._wrap_get_time_slice, self)
def _wrap_get_time_slice(self):
thread.start_new_thread(ScriptAdapter._wrap_get_time_slice_callback, (self,))
def _wrap_get_time_slice_callback(self):
self._ret_val = self._policy.get_time_slice()
self._g_mutex.unlock()
## @brief Return the global shared variable with the methods' last return value
def get_return_value(self):
return self._ret_val

View File

@ -147,7 +147,10 @@ int
PythonPolicy::get_time_slice() const throw(UserInterruptException)
{
PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL);
Py_DECREF(retval);
// Do minimal debugging
if(!retval) PyErr_Print();
else Py_DECREF(retval);
wait_unlock();