ffi/unsafe/global: add get-place-table

This commit is contained in:
Matthew Flatt 2017-12-31 08:23:04 -06:00
parent fb99c0bc57
commit 0ace17a3e9
7 changed files with 30 additions and 10 deletions

View File

@ -12,7 +12,7 @@
(define collection 'multi) (define collection 'multi)
(define version "6.11.0.5") (define version "6.11.0.6")
(define deps `("racket-lib" (define deps `("racket-lib"
["racket" #:version ,version])) ["racket" #:version ,version]))

View File

@ -2,12 +2,12 @@
@(require "utils.rkt" @(require "utils.rkt"
(for-label ffi/unsafe/global)) (for-label ffi/unsafe/global))
@title{Process-Wide Registration} @title[#:tag "unsafe-global"]{Process-Wide and Place-Wide Registration}
@defmodule[ffi/unsafe/global]{The @defmodule[ffi/unsafe/global]{The
@racketmodname[ffi/unsafe/global] library provides a utility @racketmodname[ffi/unsafe/global] library provides a utility
registering information that spans all places in the Racket registering information that is local to a place or
process.} spans all places in the Racket process.}
@history[#:added "6.9.0.5"] @history[#:added "6.9.0.5"]
@ -29,3 +29,10 @@ not refer to garbage-collected memory.
This function is intended for infrequent use with a small number of This function is intended for infrequent use with a small number of
keys.} keys.}
@defproc[(get-place-table-global) hash?]{
Returns a place-specific, mutable, @racket[eq?]-based hash table.
The result is always the same for a particular place.
@history[#:added "6.11.0.6"]}

View File

@ -1,8 +1,13 @@
#lang racket/base #lang racket/base
(require (only-in '#%unsafe (require (only-in '#%unsafe
unsafe-register-process-global)) unsafe-register-process-global
unsafe-get-place-table))
(provide register-process-global) (provide register-process-global
get-place-table)
(define (register-process-global bstr val) (define (register-process-global bstr val)
(unsafe-register-process-global bstr val)) (unsafe-register-process-global bstr val))
(define (get-place-table)
(unsafe-get-place-table))

View File

@ -31,6 +31,7 @@
unsafe-custodian-register unsafe-custodian-register
unsafe-custodian-unregister unsafe-custodian-unregister
unsafe-register-process-global unsafe-register-process-global
unsafe-get-place-table
unsafe-make-security-guard-at-root unsafe-make-security-guard-at-root
unsafe-set-on-atomic-timeout! unsafe-set-on-atomic-timeout!
unsafe-abort-current-continuation/no-wind unsafe-abort-current-continuation/no-wind

View File

@ -15,7 +15,7 @@
#define USE_COMPILED_STARTUP 1 #define USE_COMPILED_STARTUP 1
#define EXPECTED_PRIM_COUNT 1161 #define EXPECTED_PRIM_COUNT 1161
#define EXPECTED_UNSAFE_COUNT 156 #define EXPECTED_UNSAFE_COUNT 157
#define EXPECTED_FLFXNUM_COUNT 69 #define EXPECTED_FLFXNUM_COUNT 69
#define EXPECTED_EXTFL_COUNT 45 #define EXPECTED_EXTFL_COUNT 45
#define EXPECTED_FUTURES_COUNT 15 #define EXPECTED_FUTURES_COUNT 15

View File

@ -13,12 +13,12 @@
consistently.) consistently.)
*/ */
#define MZSCHEME_VERSION "6.11.0.5" #define MZSCHEME_VERSION "6.11.0.6"
#define MZSCHEME_VERSION_X 6 #define MZSCHEME_VERSION_X 6
#define MZSCHEME_VERSION_Y 11 #define MZSCHEME_VERSION_Y 11
#define MZSCHEME_VERSION_Z 0 #define MZSCHEME_VERSION_Z 0
#define MZSCHEME_VERSION_W 5 #define MZSCHEME_VERSION_W 6
#define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y)
#define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)

View File

@ -339,6 +339,7 @@ static Scheme_Object *unsafe_custodian_register(int argc, Scheme_Object *argv[])
static Scheme_Object *unsafe_custodian_unregister(int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_custodian_unregister(int argc, Scheme_Object *argv[]);
static Scheme_Object *unsafe_register_process_global(int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_register_process_global(int argc, Scheme_Object *argv[]);
static Scheme_Object *unsafe_get_place_table(int argc, Scheme_Object *argv[]);
static Scheme_Object *unsafe_set_on_atomic_timeout(int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_set_on_atomic_timeout(int argc, Scheme_Object *argv[]);
static Scheme_Object *make_plumber(int argc, Scheme_Object *argv[]); static Scheme_Object *make_plumber(int argc, Scheme_Object *argv[]);
@ -651,6 +652,7 @@ scheme_init_unsafe_thread (Scheme_Env *env)
GLOBAL_PRIM_W_ARITY("unsafe-custodian-unregister", unsafe_custodian_unregister, 2, 2, env); GLOBAL_PRIM_W_ARITY("unsafe-custodian-unregister", unsafe_custodian_unregister, 2, 2, env);
GLOBAL_PRIM_W_ARITY("unsafe-register-process-global", unsafe_register_process_global, 2, 2, env); GLOBAL_PRIM_W_ARITY("unsafe-register-process-global", unsafe_register_process_global, 2, 2, env);
GLOBAL_PRIM_W_ARITY("unsafe-get-place-table", unsafe_get_place_table, 0, 0, env);
GLOBAL_PRIM_W_ARITY("unsafe-set-on-atomic-timeout!", unsafe_set_on_atomic_timeout, 1, 1, env); GLOBAL_PRIM_W_ARITY("unsafe-set-on-atomic-timeout!", unsafe_set_on_atomic_timeout, 1, 1, env);
@ -2789,6 +2791,11 @@ static Scheme_Object *unsafe_register_process_global(int argc, Scheme_Object *ar
return scheme_false; return scheme_false;
} }
static Scheme_Object *unsafe_get_place_table(int argc, Scheme_Object *argv[])
{
return scheme_get_place_table();
}
void scheme_init_process_globals(void) void scheme_init_process_globals(void)
{ {
#if defined(MZ_USE_MZRT) #if defined(MZ_USE_MZRT)