A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-August/128195.html below:

[Python-Dev] Add function to signal module for getting main thread id

[Python-Dev] Add function to signal module for getting main thread id [Python-Dev] Add function to signal module for getting main thread idAndrew Svetlov andrew.svetlov at gmail.com
Fri Aug 30 11:24:07 CEST 2013
Main thread is slightly different from others.
Signals can be subscribed from main thread only.
Tulip has special logic for main thread.
In application code we can explicitly know which thread is executed,
main or not.
But from library it's not easy.
Tulip uses check like
    threading.current_thread().name == 'MainThread'
This approach has a problem: thread name is writable attribute and can
be changed by user code.

My proposition is to add function like get_mainthread_id() -> int
which return ident for main thread (I know function name is not
perfect, please guess better one).
Signal module already has required data as internal variable
static long main_thread;
I just guess to expose this value to python.
Thoughts?

-- 
Thanks,
Andrew Svetlov
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4