#include <ActivityManager.hpp>
Static Public Attributes | |
static RexxActivity *volatile | currentActivity = OREF_NULL |
Protected Types | |
enum | { MAX_THREAD_POOL_SIZE = 5 } |
Static Protected Attributes | |
static RexxList * | activeActivities |
static RexxList * | availableActivities = OREF_NULL |
static RexxList * | allActivities = OREF_NULL |
static RexxIdentityTable * | subClasses |
static bool | processTerminating = false |
static size_t | interpreterInstances = 0 |
static SysMutex | kernelSemaphore |
static SysSemaphore | terminationSem |
static volatile bool | sentinel = false |
static std::deque< RexxActivity * > | waitingActivities |
Definition at line 49 of file ActivityManager.hpp.
|
protected |
Enumerator | |
---|---|
MAX_THREAD_POOL_SIZE |
Definition at line 111 of file ActivityManager.hpp.
|
static |
Return an activity to the activity pool.
activityObject | The released activity. |
Definition at line 656 of file ActivityManager.cpp.
References allActivities, RexxList::items(), postTermination(), processTerminating, and RexxList::removeItem().
Referenced by RexxActivity::runThread().
|
static |
Add a waiting activity to the waiting queue.
waitingAct | The activity to queue up. |
release | If true, the kernel lock should be released on completion. |
Definition at line 132 of file ActivityManager.cpp.
References addWaitingActivityCount, RexxActivity::clearWait(), currentActivity, RexxActivity::getNumericSettings(), hasWaiters(), lockKernel(), ResourceSection::reacquire(), ResourceSection::release(), sentinel, Numerics::setCurrentSettings(), unlockKernel(), RexxActivity::waitForDispatch(), waitingActivities, and SysActivity::yield().
Referenced by relinquish(), and RexxActivity::requestAccess().
|
static |
Definition at line 121 of file ActivityManager.cpp.
References addWaitingActivityCount.
Referenced by RexxActivation::rexxVariable().
|
static |
Attach an activity to an interpreter instance
instance | The interpreter instance involved. |
Definition at line 747 of file ActivityManager.cpp.
References createCurrentActivity(), currentActivity, findActivity(), lockKernel(), OREF_NULL, RexxActivity::requestAccess(), sentinel, RexxActivity::setNestedActivity(), RexxActivity::setSuspended(), and unlockKernel().
Referenced by InterpreterInstance::attachThread().
|
static |
|
static |
Definition at line 407 of file ActivityManager.cpp.
References availableActivities, OREF_NULL, RexxList::removeFirstItem(), and RexxActivity::terminatePoolActivity().
Referenced by shutdown().
|
static |
Create the global kernel lock for the ActivityManager.
Definition at line 592 of file ActivityManager.cpp.
References SysSemaphore::close(), SysMutex::close(), kernelSemaphore, and terminationSem.
Referenced by Interpreter::processShutdown().
|
static |
Create an activity object for the current thread.
Definition at line 375 of file ActivityManager.cpp.
References allActivities, and RexxList::append().
Referenced by attachThread(), and getRootActivity().
|
static |
Terminate an interpreter instance. This starts process shutdown if the last instance goes away.
Definition at line 211 of file ActivityManager.cpp.
References interpreterInstances.
|
static |
Create the global kernel lock for the ActivityManager.
Definition at line 581 of file ActivityManager.cpp.
References SysSemaphore::create(), SysMutex::create(), kernelSemaphore, SysSemaphore::reset(), and terminationSem.
Referenced by Interpreter::processStartup().
|
static |
Obtain a new activity for running on a separate thread.
Definition at line 344 of file ActivityManager.cpp.
References allActivities, RexxList::append(), availableActivities, OREF_NULL, ResourceSection::reacquire(), ResourceSection::release(), RexxList::removeFirstItem(), and RexxActivity::reset().
Referenced by createNewActivity(), new_activity(), and InterpreterInstance::spawnActivity().
|
static |
Clone off an activity from an existing activity. Used for message start() are early reply operations.
parent | The currently running activity. The activity-specific settings are inherited from the parent. |
Definition at line 397 of file ActivityManager.cpp.
References createNewActivity(), and RexxActivity::inheritSettings().
|
static |
Definition at line 549 of file ActivityManager.cpp.
|
static |
Definition at line 540 of file ActivityManager.cpp.
References SysActivity::queryThreadID().
Referenced by attachThread(), getActivity(), getRootActivity(), haltActivity(), and setActivityTrace().
|
static |
Definition at line 514 of file ActivityManager.cpp.
References allActivities, RexxList::getValue(), RexxActivity::isSuspended(), RexxActivity::isThread(), RexxList::lastIndex(), LIST_END, OREF_NULL, and RexxList::previousIndex().
|
static |
Get an already existing activity for the current thread and give it kernel access before returning. This will fail if the thread has not been properly attached.
Definition at line 790 of file ActivityManager.cpp.
References RexxActivity::enterCurrentThread(), findActivity(), and OREF_NULL.
Referenced by NativeContextBlock::NativeContextBlock().
|
static |
Retrieve the current .local directory instance.
Definition at line 854 of file ActivityManager.cpp.
References currentActivity, RexxActivity::getLocal(), and OREF_NULL.
Referenced by RexxDirectory::atRexx(), and RexxLocal::local().
|
static |
Retrieve a variable from the current local environment object.
name | The name of the environment variable. |
Definition at line 839 of file ActivityManager.cpp.
References currentActivity, RexxActivity::getLocalEnvironment(), OREF_NULL, and TheNilObject.
Referenced by RexxSource::findClass(), Interpreter::findClass(), and Interpreter::getCurrentQueue().
|
static |
Get a root activity for a new interpreter instance.
Definition at line 680 of file ActivityManager.cpp.
References RexxActivity::activate(), createCurrentActivity(), currentActivity, findActivity(), lockKernel(), OREF_NULL, RexxActivity::requestAccess(), sentinel, RexxActivity::setInterpreterRoot(), RexxActivity::setNestedActivity(), RexxActivity::setSuspended(), and unlockKernel().
Referenced by Interpreter::createInterpreterInstance().
|
static |
Definition at line 455 of file ActivityManager.cpp.
References findActivity(), RexxActivity::halt(), and OREF_NULL.
Referenced by RexxHaltThread().
|
static |
|
inlinestatic |
Definition at line 57 of file ActivityManager.hpp.
References waitingActivities.
Referenced by addWaitingActivity(), and relinquish().
|
static |
Initialize the activity manager when the interpreter starts up.
Definition at line 79 of file ActivityManager.cpp.
References allActivities, availableActivities, currentActivity, new_list(), and OREF_NULL.
Referenced by RexxMemory::createImage(), and RexxMemory::restore().
|
static |
Definition at line 86 of file ActivityManager.cpp.
References allActivities, availableActivities, and memory_mark.
Referenced by RexxMemory::live().
|
static |
Definition at line 101 of file ActivityManager.cpp.
References allActivities, availableActivities, memory_mark_general, memoryObject, and RexxMemory::savingImage().
Referenced by RexxMemory::liveGeneral().
|
static |
Definition at line 557 of file ActivityManager.cpp.
References kernelSemaphore, and SysMutex::request().
Referenced by addWaitingActivity(), attachThread(), and getRootActivity().
|
static |
Try a fast request for the kernel. This requires A) there be no waiting activities and B) that it be possible to request the semaphore without waiting.
Definition at line 607 of file ActivityManager.cpp.
References kernelSemaphore, SysMutex::requestImmediate(), and waitingActivities.
Referenced by RexxActivity::requestAccess().
|
static |
Create a new activation for an internal level call (internal call or interpreted execution).
activity | The activity we're running on. |
parent | The parent activation. OREF_NULL is used if this is a top-level call. |
code | The code object associated with the method. |
context | The context of the invocation. |
Definition at line 282 of file ActivityManager.cpp.
|
static |
Create a new activation for a method invocation (vs. a program or routine call)
activity | The activity we're running on. |
method | The method object being invoked. |
code | The code object associated with the method. |
Definition at line 300 of file ActivityManager.cpp.
|
static |
Create a new activation for a toplevel activation using a routine (vs. a method invocation).
activity | The activity we're running on. |
routine | The routine object we're calling. |
code | The code object associated with the method. |
calltype | The type of call being made. |
environment | The initial address environment. |
context | The context of the invocation. |
Definition at line 262 of file ActivityManager.cpp.
Referenced by RexxCode::call(), RexxActivation::debugInterpret(), RexxActivation::internalCall(), RexxActivation::internalCallTrap(), RexxActivation::interpret(), and RexxCode::run().
|
static |
Create a new activation for a a native external call stack
activity | The activity we're running on. |
Definition at line 331 of file ActivityManager.cpp.
|
static |
Create a new activation for a a native external call stack
activity | The activity we're running on. |
parent | The parent activation. |
Definition at line 316 of file ActivityManager.cpp.
Referenced by RexxNativeRoutine::call(), RegisteredRoutine::call(), RexxActivity::createNewActivationStack(), RexxActivity::exitKernel(), RexxActivity::run(), and RexxNativeMethod::run().
|
static |
Return an activity to the available pool. If we're in the process of shutting down, or have too many pool activities, we'll return false to tell the activity to completely shut things down.
activity | The activity we're adding back to the available pool. |
Definition at line 434 of file ActivityManager.cpp.
References allActivities, RexxList::append(), availableActivities, RexxActivity::cleanupActivityResources(), RexxList::items(), MAX_THREAD_POOL_SIZE, processTerminating, and RexxList::removeItem().
Referenced by InterpreterInstance::poolActivity().
|
inlinestatic |
Definition at line 100 of file ActivityManager.hpp.
References SysSemaphore::post(), and terminationSem.
Referenced by activityEnded().
|
static |
Switch the active activity if there are other activities waiting to run.
activity | The current active activity. |
Definition at line 819 of file ActivityManager.cpp.
References addWaitingActivity(), hasWaiters(), and relinquishCount.
Referenced by RexxActivity::relinquish().
|
static |
Definition at line 808 of file ActivityManager.cpp.
References relinquishCount.
Referenced by RexxActivation::rexxVariable().
|
static |
Return an activity to the activity pool.
activityObject | The released activity. |
Definition at line 625 of file ActivityManager.cpp.
References allActivities, OREF_NULL, RexxList::removeItem(), and RexxActivity::setSuspended().
Referenced by RexxMemory::createImage(), and InterpreterInstance::detachThread().
|
static |
return a root activity when an interpreter instance terminates.
Definition at line 724 of file ActivityManager.cpp.
References allActivities, RexxActivity::cleanupActivityResources(), RexxActivity::detachInstance(), and RexxList::removeItem().
Referenced by InterpreterInstance::terminate().
|
static |
Definition at line 474 of file ActivityManager.cpp.
References findActivity(), OREF_NULL, and RexxActivity::setTrace().
Referenced by RexxResetThreadTrace(), and RexxSetThreadTrace().
|
static |
Shutdown the activity manager and initiate interpreter termination.
Definition at line 236 of file ActivityManager.cpp.
References clearActivityPool(), and processTerminating.
Referenced by terminateInterpreter().
|
static |
Terminate an interpreter instance. This starts process shutdown if the last instance goes away.
Definition at line 221 of file ActivityManager.cpp.
References interpreterInstances, and shutdown().
|
static |
|
static |
Definition at line 565 of file ActivityManager.cpp.
References currentActivity, kernelSemaphore, OREF_NULL, SysMutex::release(), and sentinel.
Referenced by addWaitingActivity(), attachThread(), getRootActivity(), and RexxActivity::releaseAccess().
|
inlinestatic |
Definition at line 105 of file ActivityManager.hpp.
References terminationSem, and SysSemaphore::wait().
|
static |
Definition at line 508 of file ActivityManager.cpp.
References SysActivity::yieldCounter().
Referenced by RexxActivation::rexxVariable().
|
static |
Definition at line 493 of file ActivityManager.cpp.
References currentActivity, OREF_NULL, and RexxActivity::yield().
|
staticprotected |
Definition at line 117 of file ActivityManager.hpp.
Definition at line 121 of file ActivityManager.hpp.
Referenced by activityEnded(), createCurrentActivity(), createNewActivity(), findActivity(), init(), live(), liveGeneral(), poolActivity(), returnActivity(), and returnRootActivity().
Definition at line 119 of file ActivityManager.hpp.
Referenced by clearActivityPool(), createNewActivity(), init(), live(), liveGeneral(), and poolActivity().
|
static |
Definition at line 98 of file ActivityManager.hpp.
Referenced by addWaitingActivity(), RexxDirectory::allIndexesItems(), RexxDirectory::allItems(), RexxDirectory::appendAllIndexesItemsTo(), RexxDirectory::at(), RexxDirectory::atRexx(), attachThread(), RexxNativeActivation::callNativeRoutine(), CalloutBlock::CalloutBlock(), RexxNativeActivation::callRegisteredRoutine(), RoutineClass::callRexx(), RoutineClass::callWithRexx(), RexxObject::checkPackage(), RexxObject::checkPrivate(), RexxString::checkTE(), RexxCompoundVariable::clearGuard(), RexxStemVariable::clearGuard(), RexxParseVariable::clearGuard(), RexxMemory::createImage(), RexxObject::decodeMessageName(), RexxActivity::enterCurrentThread(), RexxSource::error(), RexxSource::errorLine(), RexxSource::errorPosition(), RexxSource::errorToken(), RexxExpressionFunction::evaluate(), RexxInstructionCall::execute(), RexxInstructionGuard::execute(), RexxInstructionParse::execute(), RexxInstructionQueue::execute(), RexxActivation::exitFrom(), PackageClass::findProgramRexx(), GetConcurrencyInfos(), getLocal(), getLocalEnvironment(), getRootActivity(), RexxDirectory::indexRexx(), init(), RexxSource::install(), RexxActivation::interpret(), lastMessageName(), lastMethod(), LibraryPackage::loadPackage(), PackageClass::loadPackage(), RexxNumberString::maxMin(), RexxObject::messageSend(), RexxMethod::newMethodObject(), PackageClass::newRexx(), RoutineClass::newRoutineObject(), RexxText::newText(), RexxVariable::notify(), RexxObject::processProtectedMethod(), RexxObject::processUnknown(), ProtectedObject::ProtectedObject(), RexxDirectory::pushAllIndexesItemsTo(), RexxActivation::raise(), RexxActivity::releaseAccess(), reportCondition(), reportException(), reportNomethod(), RexxActivity::requestAccess(), RexxObject::requestString(), RexxMessage::result(), RexxActivity::run(), RexxNativeActivation::run(), RexxObject::run(), RexxActivity::runThread(), RexxMemory::runUninits(), RexxMessage::send(), RexxMessage::sendNotification(), RexxCompoundVariable::setGuard(), RexxStemVariable::setGuard(), RexxParseVariable::setGuard(), RexxMessage::start(), RexxDirectory::supplier(), RexxSource::traceBack(), RexxSource::translate(), RexxInstructionCall::trap(), LibraryPackage::unload(), unlockKernel(), UnsafeBlock::UnsafeBlock(), RexxActivity::updateFrameMarkers(), and yieldCurrentActivity().
|
staticprotected |
Definition at line 124 of file ActivityManager.hpp.
Referenced by createInterpreter(), and terminateInterpreter().
|
staticprotected |
Definition at line 126 of file ActivityManager.hpp.
Referenced by closeLocks(), createLocks(), lockKernel(), lockKernelImmediate(), and unlockKernel().
|
staticprotected |
Definition at line 123 of file ActivityManager.hpp.
Referenced by activityEnded(), poolActivity(), and shutdown().
|
staticprotected |
Definition at line 128 of file ActivityManager.hpp.
Referenced by addWaitingActivity(), attachThread(), getRootActivity(), and unlockKernel().
|
staticprotected |
Definition at line 122 of file ActivityManager.hpp.
|
staticprotected |
Definition at line 127 of file ActivityManager.hpp.
Referenced by closeLocks(), createLocks(), postTermination(), and waitForTermination().
|
staticprotected |
Definition at line 129 of file ActivityManager.hpp.
Referenced by addWaitingActivity(), hasWaiters(), and lockKernelImmediate().