The current thread
| 558 | |
| 559 | |
| 560 | class CurrentThread(Thread): |
| 561 | """The current thread""" |
| 562 | @property #It's not a fixedpropety because executing thread might change |
| 563 | def tid(self): |
| 564 | """Thread ID |
| 565 | |
| 566 | :type: :class:`int` |
| 567 | """ |
| 568 | return winproxy.GetCurrentThreadId() |
| 569 | |
| 570 | @property |
| 571 | def owner(self): |
| 572 | """The current process |
| 573 | |
| 574 | :type: :class:`CurrentProcess` |
| 575 | """ |
| 576 | return windows.current_process |
| 577 | |
| 578 | def _get_handle(self): |
| 579 | return winproxy.GetCurrentThread() |
| 580 | |
| 581 | def __del__(self): |
| 582 | pass |
| 583 | |
| 584 | def exit(self, code=0): |
| 585 | """Exit the thread""" |
| 586 | return winproxy.ExitThread(code) |
| 587 | |
| 588 | |
| 589 | |
| 590 | def wait(self, timeout=INFINITE): |
| 591 | """Raise :class:`ValueError` to prevent deadlock :D""" |
| 592 | raise ValueError("wait() on current thread") |
| 593 | |
| 594 | |
| 595 | class CurrentProcess(Process): |