- Fixed test-pyloader
git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@791 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
5e40f9a8c1
commit
66a2d414f2
|
@ -82,6 +82,19 @@ class ScriptAdapter :
|
||||||
self._ret_val = self._policy.is_preemptive()
|
self._ret_val = self._policy.is_preemptive()
|
||||||
self._g_mutex.unlock()
|
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
|
## @brief Return the global shared variable with the methods' last return value
|
||||||
def get_return_value(self):
|
def get_return_value(self):
|
||||||
return self._ret_val
|
return self._ret_val
|
||||||
|
|
|
@ -147,7 +147,10 @@ int
|
||||||
PythonPolicy::get_time_slice() const throw(UserInterruptException)
|
PythonPolicy::get_time_slice() const throw(UserInterruptException)
|
||||||
{
|
{
|
||||||
PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL);
|
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();
|
wait_unlock();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue