~ chicken-core (chicken-5) b8c8d460a5c7e64aa7fafb5969b0b4ee3b6af8e0


commit b8c8d460a5c7e64aa7fafb5969b0b4ee3b6af8e0
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Sep 6 05:09:03 2010 -0400
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Sep 6 05:09:03 2010 -0400

    thread-specific is settable

diff --git a/manual/Unit srfi-18 b/manual/Unit srfi-18
index c8eea6fe..418b4e11 100644
--- a/manual/Unit srfi-18	
+++ b/manual/Unit srfi-18	
@@ -368,11 +368,14 @@ Returns the content of the {{thread}}'s specific field.
 Stores {{obj}} into the {{thread}}'s specific field.
 {{thread-specific-set!}} returns an unspecified value.
 
-
      (thread-specific-set! (current-thread) "hello")  ==>  ''unspecified''
   
      (thread-specific (current-thread))               ==>  "hello"
 
+Alternatively, you can use
+
+     (set! (thread-specific (current-thread)) "hello")
+
 <procedure>(thread-start! thread)</procedure><br>
 
 Makes {{thread}} runnable. The {{thread}} must be a new thread.
diff --git a/srfi-18.scm b/srfi-18.scm
index 36c48fbf..676f8b01 100644
--- a/srfi-18.scm
+++ b/srfi-18.scm
@@ -132,14 +132,17 @@
   (##sys#check-structure thread 'thread 'thread-state)
   (##sys#slot thread 3) )
 
-(define (thread-specific thread)
-  (##sys#check-structure thread 'thread 'thread-specific)
-  (##sys#slot thread 10) )
-
 (define (thread-specific-set! thread x)
   (##sys#check-structure thread 'thread 'thread-specific-set!)
   (##sys#setslot thread 10 x) )
 
+(define thread-specific
+  (getter-with-setter
+   (lambda (thread)
+     (##sys#check-structure thread 'thread 'thread-specific)
+     (##sys#slot thread 10) )
+   thread-specific-set!))
+
 (define (thread-quantum thread)
   (##sys#check-structure thread 'thread 'thread-quantum)
   (##sys#slot thread 9) )
Trap