Wiki

Clone wiki

pymoult / alterability

Alterability

The module lowlevel.alterability provides tools for detecting the alterability state by verifying the alterability conditions.

  • get_current_frames() returns the top frames of each thread currently running.

Quiescence of functions

To be used in heck_alterability`

  • isFunctionInStack(function,thread) checks if function is in the the stack of thread.

  • isFunctionInAnyStack(function,threads=None) checks if functionn is in the stack of any thread of the program if threads is None (default). If threads is not None, it must be a list of threads that will be checked.

  • checkQuiescenceOfFunction(func,threads=[]) returns True if func is quiescent in the threads, False if not.

  • checkQuiescenceOfFunctions(funcs,threads=[]) Same as checkQuiescenceOfFunction(func,threads=[]) but uses a list of functions instead.

To be used in wait_alterability

  • waitQuiescenceOfFunction(func,threads=[]) waits until func is quiescent in threads then returns True. Returns False is timeout is reached.

  • waitQuiescenceOfFunction(func,threads=[]) Same as waitQuiescenceOfFunction(func,threads=[]) but uses a list of functions instead.

To be used in resume_hook

  • resumeSuspendedThreads(threads=[]) Will resume the threads. This function must be used whenever using checkQuiescenceOfFunction or waitQuiescenceOfFunction with an emmpty list of threads (the argument must be an empty list too).

Forcing quiescence

To be used in preupdate_setup

  • setupForceQuiescence(module,function) sets up for forcing the quiescence of function from module. Returns two events quiescent and can_continue as well a watcher thread to be given as arguments for further methods.

To be used in check_alterabilty

  • checkForceQuiescence(quiescent) returns True if the function is quiescent, False if not. Takes quiescent as argument

To be used in wait_alterability

  • waitForceQuiescence(quiescent) returns True when the function is quiescent, returns False if timeout is reached before. Takes quiescent as argument

To be used in preresume_setup

  • cleanForceQuiescence(can_continue) cleans everything installed at the preupdate_setup phase. Takes can_continue as argument.

To be used in clean_failed_alterability

  • cleanFailedForceQuiescence(can_continue,quiescent,watcher,module,function) cleans everything installed at the preupdate_setup phase and unblocks the function. Takes the return values of setupForceQUiescence as arguments plus the function and its module.

Static update points

To be used in the application code

  • staticUpdatePoint() indicates a static update point. This function has to be placed in the code of the application (not in the update code). The function containing the static update point must be called by DSUThreads.

To be used in preupdate_setup

  • setupWaitStaticPoint(threads) prepares for waiting static update points of threads

To be used in check_alterability

  • checkStaticPointReached(threads) returns True if all threads have reached a static point, False if not.

To be used in wait_alterability

  • waitStaticPoints(threads) waits for all the threads in the threads list to reach a staticUpdatePoint.

To be used in clean_failed_alterability

  • cleanFailedStaticPoints(threads) cleans the threads that were setup for waiting static points

To be used in resume_hook

  • resumeSuspendedThreads(threads=[]) (as seen in function quiescence)

Updated