Is it Ok to use id(threading.current_thread()) as thread identifier in thread's whole life?

Viewed 92

I need store data for a thread when it havn't been started. After the thread start, it read the data. So i need get the thread identifier before it started. Python's threading.Thread.ident and threading.Thread.native_id only have value when thread is alive.

Now i use id(threading.Thread()) get thread identifier before it start, and use id(threading.current_thread()) in thread. Is this OK or there are some better solution? Thanks.

0 Answers
Related