Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- npm
- 노드 엑셀
- doorlock
- shellcraft
- pwntools
- 코드게이트
- Branch
- CVE
- lob
- 코드게이트 주니어
- Codegate
- module
- pwnable
- https설정
- NGINX
- gogs
- node.js
- CODEGATE2018
- blueborne
- codegate2017
- BLUETOOTH
- gogs private git
- 코드게이트2017
- Git
- openctf
- 도메인 https
- node
- xlsx
- Hacking
- https
Archives
- Today
- Total
고졸백수해킹일기
python thread의 알쓸신잡 본문
보통 많은 사람들이 threading를 import 하여 많이 사용을 하더라..
thread가 돌고있는 함수에서 return을 받아야 할 일이 있었는데,
찾아보니까 join함수를 쓰면 된다고 하더라..
근데 얼레라 안되네?
또 찾아보니까 threading 클래스를 overwrite해서 join을 쓰면 된다고 한다.
class ThreadWithReturnValue(threading.Thread):
def __init__(self, group=None, target=None, name=None,args=(), kwargs={}, Verbose=None):
threading.Thread.__init__(self, group, target, name, args, kwargs)
self._return = None
def run(self):
#print(type(self._target))
if self._target is not None:
self._return = self._target(*self._args,**self._kwargs)
def join(self, *args):
threading.Thread.join(self, *args)
return self._return
sockServer = ThreadWithReturnValue(target=setSocket,args=(myIP,))
sockServer.start()
tmp = sockServer.join()
이런식으루 하면 tmp에 setSocket이 스레드로 실행되고 난 뒤의 값이 담긴다.
'코딩 > python' 카테고리의 다른 글
os.system의 결과를 변수로 받아오기 (0) | 2020.10.08 |
---|