kopia lustrzana https://github.com/micropython/micropython-lib
threading: Add very bare implementation of Thread class.
rodzic
da124acfdb
commit
429f73c4a3
|
@ -0,0 +1,15 @@
|
|||
import _thread
|
||||
|
||||
|
||||
class Thread:
|
||||
|
||||
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None):
|
||||
self.target = target
|
||||
self.args = args
|
||||
self.kwargs = {} if kwargs is None else kwargs
|
||||
|
||||
def start(self):
|
||||
_thread.start_new_thread(self.run, ())
|
||||
|
||||
def run(self):
|
||||
self.target(*self.args, **self.kwargs)
|
Ładowanie…
Reference in New Issue