Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# This file is part of Xpra. 

2# Copyright (C) 2012-2013 Antoine Martin <antoine@xpra.org> 

3# Xpra is released under the terms of the GNU GPL v2, or, at your option, any 

4# later version. See the file COPYING for details. 

5 

6""" 

7Intercepting thread creation 

8 

9This is only here so we can intercept the creation 

10of all deamon threads and inject some code. 

11This is used by the pycallgraph test wrapper. 

12(this is cleaner than overriding the threading module directly 

13 as only our code will be affected) 

14""" 

15 

16from threading import Thread 

17 

18def make_thread(target : callable, name : str, daemon : bool=False, args=()) -> Thread: 

19 t = Thread(target=target, name=name, args=args) 

20 t.daemon = daemon 

21 return t 

22 

23def start_thread(target : callable, name : str, daemon : bool=False, args=()) -> Thread: 

24 t = make_thread(target, name, daemon, args=args) 

25 t.start() 

26 return t