Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.17 KB

1.2.0.md

File metadata and controls

50 lines (37 loc) · 1.17 KB

Change log 1.2.0

Date: 20160514

Send variables to child thread easily

(timp-send-variable thread &rest variables)

Because child threads do not load the user setting init file. Some global variables may be difference from parent thread. This function provides a very easy way to set variables in child thread the same as parent thread.

(setq a 1)
(setq b "a")
;; Setup two variables

(setq mythread (timp-get :persist t))
;; Create a new thread

(timp-send-code mythread
                :error-handler 'timp-debug-print
                :code `(message "a is %d" a))
;; t
;; In *timp log*
;; $ ((message "a is %d" a) void-variable a)

(timp-send-code mythread
                :error-handler 'timp-debug-print
                :code `(message "b is %s" b))
;; t
;; In *timp log*
;; $((message "b is %d" b) void-variable b)

(timp-send-variable mythread a b)
;; t

(timp-send-code mythread
                :error-handler 'timp-debug-print
                :code `(message "a is %d" a))
;; a is 1

(timp-send-code mythread
                :error-handler 'timp-debug-print
                :code `(message "b is %s" b))
;; b is a

;; Now a and b are both set up in child thread