Add run_in_main_thread as helper for those wanting to run server code from web view. Resolve #2457

This commit is contained in:
Griatch 2022-02-12 18:44:38 +01:00
parent 9ee97d9b6c
commit a17fa2a454
3 changed files with 23 additions and 1 deletions

View file

@ -41,7 +41,7 @@ PROC_MODIFIED_OBJS = WeakValueDictionary()
_SELF_PID = os.getpid()
_SERVER_PID, _PORTAL_PID = get_evennia_pids()
_IS_SUBPROCESS = (_SERVER_PID and _PORTAL_PID) and _SELF_PID not in (_SERVER_PID, _PORTAL_PID)
_IS_MAIN_THREAD = threading.currentThread().getName() == "MainThread"
_IS_MAIN_THREAD = threading.current_thread().name == "MainThread"
class SharedMemoryModelBase(ModelBase):