- Finish implementing async setup for Python policies' access
- Correct method names for the Python policy (design problem?) - Compiles, but can't run it on this machine. I'll test it later (and I expect quite a lot of SIGSEGVs). git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@382 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
882a6acf5e
commit
8f655f2f69
8 changed files with 211 additions and 96 deletions
|
@ -3,6 +3,10 @@ import sgpem
|
|||
|
||||
_g_mutex = mutex.mutex()
|
||||
|
||||
## @val Synchronized return value you can read from C++
|
||||
# when a threaded function returns
|
||||
_ret_val = None
|
||||
|
||||
## @brief This is an adapter class which acts as a proxy
|
||||
# for user-implemented policies
|
||||
#
|
||||
|
@ -29,6 +33,7 @@ class ScriptAdapter :
|
|||
|
||||
def _wrap_configure(self):
|
||||
thread.start_new_thread(ScriptAdapter._wrap_configure_callback, (self,))
|
||||
|
||||
def _wrap_configure_callback(self):
|
||||
# call configure method
|
||||
self._policy.configure()
|
||||
|
@ -53,17 +58,15 @@ class ScriptAdapter :
|
|||
thread.start_new_thread(ScriptAdapter._wrap_is_preemptible_callback, (self,))
|
||||
|
||||
def _wrap_is_preemptible_callback(self):
|
||||
# FIXME : here we should return the call value
|
||||
self._policy.is_preemptible()
|
||||
_ret_val = self._policy.is_preemptible()
|
||||
_g_mutex.unlock()
|
||||
|
||||
def async_is_timesliced(self):
|
||||
_g_mutex.lock(ScriptAdapter._wrap_is_timesliced, self)
|
||||
def async_get_time_slice(self):
|
||||
_g_mutex.lock(ScriptAdapter._wrap_get_time_slice, self)
|
||||
|
||||
def _wrap_is_timesliced(self):
|
||||
thread.start_new_thread(ScriptAdapter._wrap_is_timesliced_callback, (self,))
|
||||
def _wrap_get_time_slice(self):
|
||||
thread.start_new_thread(ScriptAdapter._wrap_get_time_slice_callback, (self,))
|
||||
|
||||
def _wrap_is_timesliced_callback(self):
|
||||
# FIXME : return value!
|
||||
self._policy.is_timesliced()
|
||||
def _wrap_get_time_slice_callback(self):
|
||||
_ret_val = self._policy.get_time_slice()
|
||||
_g_mutex.unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue