You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.
Should be somewhat possible to implement something like this with a few new actions:
NEW_THREAD(*args,**kwargs)
Creates a new thread and supplies the specified *args and **kwargs to the thread constructor
LOCK_LOCK(n)
waits until the nth lock is released & locks it
RELEASE_LOCK(n)
releases the nth lock
WAIT_LOCK(n)
waits until the nth lock is released
and Algorithm callbacks:
new_thread(*args,**kwargs):
(algorithms may define it without *args and **kwargs)
gets called when NEW_THREAD is yielded, and should return a new generator that inherits BaseAlgorithm.
(this is a classmethod)
Threads should be handled like separate algorithms, where each non-waiting thread gets called equally often than the others. This should be implemented by calling them 'in a circle'. If an algorithm yields to wait, the member thread.lock should be set to the number that is specified. Every time a thread should be called, its member thread.lock has to be read & checked. If the lock is currently locked, the thread should not be called & it should continue with the next one. If a full round has been completed without a thread being called, the algorithm should be stopped and the user should be notified (per print) that a deadlock has occured.
The text was updated successfully, but these errors were encountered:
Should be somewhat possible to implement something like this with a few new actions:
Creates a new thread and supplies the specified *args and **kwargs to the thread constructor
waits until the nth lock is released & locks it
releases the nth lock
waits until the nth lock is released
and Algorithm callbacks:
(algorithms may define it without *args and **kwargs)
gets called when NEW_THREAD is yielded, and should return a new generator that inherits BaseAlgorithm.
(this is a classmethod)
Threads should be handled like separate algorithms, where each non-waiting thread gets called equally often than the others. This should be implemented by calling them 'in a circle'. If an algorithm yields to wait, the member thread.lock should be set to the number that is specified. Every time a thread should be called, its member thread.lock has to be read & checked. If the lock is currently locked, the thread should not be called & it should continue with the next one. If a full round has been completed without a thread being called, the algorithm should be stopped and the user should be notified (per print) that a deadlock has occured.
The text was updated successfully, but these errors were encountered: