Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(neon): API for thread-local data #902

Merged
merged 33 commits into from
Jun 9, 2022
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
94111d4
Add `neon::instance::Global` API for storing instance-global data.
dherman May 24, 2022
f872b76
Address review comments:
dherman May 25, 2022
6f12663
Use `'cx` as the inner lifetime of contexts.
dherman May 25, 2022
18e60f1
Get rid of `[]` overloading for `GlobalTable` in favor of an inherent…
dherman May 25, 2022
b8b089b
Immutable version of API:
dherman May 25, 2022
cf0d32a
Explicitly name the types in the transmute
dherman May 25, 2022
f5cd0ba
Explicitly name the types in the transmute.
dherman May 25, 2022
aee77f4
Add `get_or_try_init` and `get_or_init_default`
dherman May 27, 2022
9075b76
Protect re-entrant cases with "dirty" state checking
dherman Jun 1, 2022
b28f439
Use `GlobalCellValue` shorthand in type definition of `GlobalCell`.
dherman Jun 1, 2022
bbc4f22
Prettier fixups
dherman Jun 1, 2022
ff75d2d
Add a test for storing rooted objects in instance globals
dherman Jun 1, 2022
d9b8251
Minor style cleanup for `TryInitTransaction::is_trying()`
dherman Jun 1, 2022
a66e511
Global::new() can use the derived Default::default()
dherman Jun 2, 2022
507332d
Undo previous commit, which failed to type-check.
dherman Jun 2, 2022
0696901
Test that inner closure isn't even executed on re-entrant initializat…
dherman Jun 2, 2022
574877b
Make `get_or_try_init` generic for any `Result<T, E>`
dherman Jun 2, 2022
b397e2d
Change "safety" to "unwrap safety" for the `.unwrap()` comment.
dherman Jun 2, 2022
bc7d09e
Use `get_or_try_init` for the global object test, to only root the ob…
dherman Jun 2, 2022
3a0c041
Rename `Global` to `Local` and add top-level API docs for the `neon::…
dherman Jun 3, 2022
3338877
Improvements to `neon::instance` top-level API docs
dherman Jun 8, 2022
42eec50
Rename `neon::instance` to `neon::thread` and `Local` to `LocalKey`
dherman Jun 8, 2022
85d99f5
Some more documentation text about the relationships between instance…
dherman Jun 8, 2022
c906fbc
Addresses some of @kjvalencik's review suggestions:
dherman Jun 9, 2022
0f57620
Clarify doc text
dherman Jun 9, 2022
14a2fe4
Idiomatic Rust variable name in doc example
dherman Jun 9, 2022
019c2d3
Link to `neon::main` docs in doc comment
dherman Jun 9, 2022
58f80b3
Clarifying doc text about cross-thread sharing
dherman Jun 9, 2022
f3cc0ab
s/fail/panic/ in doc text
dherman Jun 9, 2022
2005e61
More docs improvements:
dherman Jun 9, 2022
d50ca63
Link to `crate::main` in the docs instead of `neon::main`
dherman Jun 9, 2022
ece0c02
More copy editing in the docs
dherman Jun 9, 2022
310cb5b
A few last copy-editing nits
dherman Jun 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Idiomatic Rust variable name in doc example
Co-authored-by: K.J. Valencik <kjvalencik@gmail.com>
  • Loading branch information
dherman and kjvalencik authored Jun 9, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 14a2fe472e9f0db2489913e5c5f1cce96128059d
4 changes: 2 additions & 2 deletions crates/neon/src/thread/mod.rs
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@
//! let worker: Handle<JsObject> = require.call_with(cx)
//! .arg(cx.string("node:worker_threads"))
//! .apply(cx)?;
//! let threadId: Handle<JsNumber> = worker.get(cx, "threadId")?;
//! Ok(threadId.value(cx) as u32)
//! let thread_id: Handle<JsNumber> = worker.get(cx, "threadId")?;
//! Ok(thread_id.value(cx) as u32)
//! }).cloned()
//! }
//! ```