summaryrefslogtreecommitdiff
path: root/modules/language/python/module/threading.scm
diff options
context:
space:
mode:
authorStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-09-06 23:40:42 +0200
committerStefan Israelsson Tampe <stefan.itampe@gmail.com>2018-09-06 23:40:42 +0200
commit8733038b4de44a8cfb669420621597457eeef88a (patch)
tree9f7345b4b407ea0919320e17955b058cb2f2a5bc /modules/language/python/module/threading.scm
parentb950c0d70a1d2c95da8d60aca7af02bc50542a2b (diff)
email policy works mm
Diffstat (limited to 'modules/language/python/module/threading.scm')
-rw-r--r--modules/language/python/module/threading.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/language/python/module/threading.scm b/modules/language/python/module/threading.scm
index 7a7d669..1f1f83b 100644
--- a/modules/language/python/module/threading.scm
+++ b/modules/language/python/module/threading.scm
@@ -2,8 +2,9 @@
#:use-module (ice-9 threads)
#:use-module (oop pf-objects)
#:use-module (language python def)
+ #:use-module (language python exceptions)
#:use-module (language python list)
- #:export (RLock start_new_thread allocate_lock))
+ #:export (RLock start_new_thread allocate_lock Thread))
(define-python-class RLock ()
(define __init__
@@ -40,3 +41,17 @@
(call-with-new-thread
(lambda ()
(apply fkn (to-list args)))))
+
+(define-python-class Thread ()
+ (define __init__
+ (lam (self (= target None) (= args '()))
+ (set self 'target target)
+ (set self 'args args)))
+
+ (define start
+ (lambda (self)
+ (call-with-new-thread
+ (lambda ()
+ (apply (ref self 'target)
+ (to-list (ref self 'args))))))))
+