Re: [scheme-reports-wg2] Threads and futures
Linas Vepstas
(19 Mar 2022 05:54 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Nieper-Wißkirchen
(19 Mar 2022 08:24 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
John Cowan
(19 Mar 2022 18:57 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Linas Vepstas
(19 Mar 2022 20:04 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Nieper-Wißkirchen
(19 Mar 2022 22:11 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Linas Vepstas
(20 Mar 2022 07:50 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
John Cowan
(20 Mar 2022 22:34 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Feeley
(21 Mar 2022 04:49 UTC)
|
Re: [scheme-reports-wg2] Threads and futures Marc Nieper-Wißkirchen (21 Mar 2022 06:28 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Nieper-Wißkirchen
(21 Mar 2022 06:54 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Ray Dillinger
(21 Mar 2022 19:00 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Dr. Arne Babenhauserheide
(21 Mar 2022 16:54 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Nieper-Wißkirchen
(21 Mar 2022 16:04 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Taylan Kammer
(23 Mar 2022 14:20 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Nieper-Wißkirchen
(23 Mar 2022 14:28 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Dr. Arne Babenhauserheide
(23 Mar 2022 15:40 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Marc Nieper-Wißkirchen
(23 Mar 2022 15:34 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Dr. Arne Babenhauserheide
(23 Mar 2022 22:08 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Ray Dillinger
(01 Apr 2022 23:04 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Per Bothner
(01 Apr 2022 23:21 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Ray Dillinger
(01 Apr 2022 23:28 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Per Bothner
(01 Apr 2022 23:50 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Ray Dillinger
(02 Apr 2022 00:01 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Per Bothner
(02 Apr 2022 00:35 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Linas Vepstas
(10 Apr 2022 23:46 UTC)
|
Re: [scheme-reports-wg2] Threads and futures
Linas Vepstas
(27 Mar 2022 16:54 UTC)
|
Am Mo., 21. März 2022 um 05:49 Uhr schrieb Marc Feeley (via srfi-226 list) <xxxxxx@srfi.schemers.org>: > > The SRFI-18 thread-specific and thread-specific-set! procedures are a primitive way of attaching local storage to a thread. It essentially gives you a single cell of local storage, but a larger data structure can be put in that cell to give more storage. That mechanism is low-level but sufficient for the programmer to create his own higher level thread abstraction. > > Gambit offers another mechanism that is based on extensible records (i.e. the definition of record subtypes). Threads are essentially records of type “thread”. Subtypes of the thread type can be defined using > > (define-type-of-thread foo > field1 > field2 > …) > > If t is a “foo” thread, then (foo-field1 t) and (foo-field1-set! t x) can be used to read and write field1 of that thread. So these fields are a form of thread local storage. Starting a thread is however more involved because the thread needs to be initialized before it is started: > > (define t (make-foo 42 …)) > > (write (foo-field1 t)) ;; prints 42 > > (thread-init! t (lambda () (write (foo-field1 (current-thread)))) > > (thread-start! t) ;; will start the thread, and it will print 42 > > This mechanism gives an O(1) access time for thread local storage, which is hard to beat. Thank you for sharing this; I will think about whether and how it fits into SRFI 226. We have actually two use cases here: Thread-local cells that are known at thread creation time and thread-local cells that are to be dynamically allocated. The former would be created via `_Thread_local` in C11, the latter with `tss_create`. Gambit's mechanism gives an optimal solution for the first use case. The second way of creating thread-local cells could be built on the first or could be an extra mechanism to exploit some performance characteristics of the underlying platform.