Start the thread's activity. It must be called at most once per thread object. It arranges for the object's run() method to be invoked in a separate thread of control. This method will raise a RuntimeError if called more than once on the same thread object.
(self)
| 943 | return "<%s(%s, %s)>" % (self.__class__.__name__, self._name, status) |
| 944 | |
| 945 | def start(self): |
| 946 | """Start the thread's activity. |
| 947 | |
| 948 | It must be called at most once per thread object. It arranges for the |
| 949 | object's run() method to be invoked in a separate thread of control. |
| 950 | |
| 951 | This method will raise a RuntimeError if called more than once on the |
| 952 | same thread object. |
| 953 | |
| 954 | """ |
| 955 | if not self._initialized: |
| 956 | raise RuntimeError("thread.__init__() not called") |
| 957 | |
| 958 | if self._started.is_set(): |
| 959 | raise RuntimeError("threads can only be started once") |
| 960 | |
| 961 | with _active_limbo_lock: |
| 962 | _limbo[self] = self |
| 963 | try: |
| 964 | _start_new_thread(self._bootstrap, ()) |
| 965 | except Exception: |
| 966 | with _active_limbo_lock: |
| 967 | del _limbo[self] |
| 968 | raise |
| 969 | self._started.wait() |
| 970 | |
| 971 | def run(self): |
| 972 | """Method representing the thread's activity. |