frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Shared mutable state in Rust (2022)

https://draft.ryhl.io/blog/shared-mutable-state/
27•vinhnx•3d ago

Comments

FpUser•3h ago
I have shared mutable state which is available through the whole application lifetime. Having ARC in this situation makes no sense, single mutex should be all I need.
LtdJorge•3h ago
Use a LazyLock for your state, then
kd5bjo•3h ago
That's also an option available to you: Mutex::new() is const, so there's no trouble putting one in a static variable. If the inner value can't be const-constructed, you'll need a way to prevent access before it's initialized; for that, you can use a OnceLock or just Box::leak() the Mutex once it's constructed and pass around a simple reference.
mplanchard•1h ago
You can Box::leak() it to make a &’static ref to it.
the__alchemist•1h ago
I think which tools you use for concurrency depends on your code style and what you're doing. For example, I haven't reached for Arc in a while. Example of the two primary ways I've been doing it:

Embedded: Mutex + critical sections + hardware interrupts. The Mutex isn't std::Mutex, but a hardware-specific one. (E.g. ARM) works in a similar way. The default syntax is a mess of RefCell, Cell, Option, with the requisite < and > characters. (The Option is so you can insert a value in on init, then it's never None) etc. I work around this with macros.

PC applications (GUI, 3D etc): std::thread and MPSC receivers/transmitters which update a state struct when they're ready. Then poll in the GUI's event loop or w/e. I believe this workflow has worked for me in lieu of Arc because I have been structuring programs with a single main thread, then sub threads which perform non-blocking tasks, then return data to the main thread.

Also: If it's a primitive type, Atomics are nice.

Artemis II crew see first glimpse of far side of Moon [video]

https://www.bbc.com/news/videos/ce3d5gkd2geo
96•mooreds•2h ago•62 comments

Eight years of wanting, three months of building with AI

https://lalitm.com/post/building-syntaqlite-ai/
158•brilee•3h ago•28 comments

A Claude Code skill that makes Claude talk like a caveman, cutting token use

https://github.com/JuliusBrussee/caveman
360•tosh•7h ago•217 comments

Finnish sauna heat exposure induces stronger immune cell than cytokine responses

https://www.tandfonline.com/doi/full/10.1080/23328940.2026.2645467#abstract
147•Growtika•3h ago•80 comments

Someone at BrowserStack Is Leaking Users' Email Address

https://shkspr.mobi/blog/2026/04/someone-at-browserstack-is-leaking-users-email-address/
268•m_km•3h ago•71 comments

Baby's Second Garbage Collector

https://www.matheusmoreira.com/articles/babys-second-garbage-collector
14•matheusmoreira•3d ago•0 comments

Lisette a little language inspired by Rust that compiles to Go

https://lisette.run/
187•jspdown•9h ago•92 comments

Friendica – A Decentralized Social Network

https://friendi.ca/
58•janandonly•5h ago•22 comments

The threat is comfortable drift toward not understanding what you're doing

https://ergosphere.blog/posts/the-machines-are-fine/
538•zaikunzhang•6h ago•386 comments

Show HN: A game where you build a GPU

https://jaso1024.com/mvidia/
861•Jaso1024•23h ago•171 comments

German implementation of eIDAS will require an Apple/Google account to function

https://bmi.usercontent.opencode.de/eudi-wallet/wallet-development-documentation-public/latest/ar...
456•DyslexicAtheist•17h ago•414 comments

Iguanaworks has closed and our products are no longer sold

http://iguanaworks.net/products/usb-ir-transceiver.html
67•ripe•3h ago•8 comments

My Google Workspace account suspension

https://zencapital.substack.com/p/sad-story-of-my-google-workspace
188•zenincognito•4h ago•85 comments

Apple approves driver that lets Nvidia eGPUs work with Arm Macs

https://twitter.com/__tinygrad__/status/2039213719155310736
465•naves•1d ago•209 comments

Hightouch (YC S19) Is Hiring

https://hightouch.com/careers#open-positions
1•joshwget•4h ago

A tail-call interpreter in (nightly) Rust

https://www.mattkeeter.com/blog/2026-04-05-tailcall/
7•g0xA52A2A•1h ago•0 comments

OpenScreen is an open-source alternative to Screen Studio

https://github.com/siddharthvaddem/openscreen
392•jskopek•4d ago•68 comments

Japanese, French and Omani Vessels Cross Strait of Hormuz

https://japantoday.com/category/politics/japanese-french-and-omani-vessels-cross-the-strait-of-ho...
89•vrganj•1h ago•68 comments

Nanocode: The best Claude Code that $200 can buy in pure JAX on TPUs

https://github.com/salmanmohammadi/nanocode/discussions/1
6•desideratum•2h ago•1 comments

Perfmon – Consolidate your favorite CLI monitoring tools into a single TUI

https://github.com/sumant1122/Perfmon
7•paperplaneflyr•2h ago•1 comments

Introduction to Computer Music (2009) [pdf]

https://composerprogrammer.com/introductiontocomputermusic.pdf
194•luu•14h ago•60 comments

Phone-free bars and restaurants on the rise across the U.S.

https://www.axios.com/2026/04/05/phone-free-restaurants-bars-bans-restrictions-offline
18•Brajeshwar•1h ago•2 comments

Shared mutable state in Rust (2022)

https://draft.ryhl.io/blog/shared-mutable-state/
27•vinhnx•3d ago•5 comments

Aegis – open-source FPGA silicon

https://github.com/MidstallSoftware/aegis
86•rosscomputerguy•10h ago•8 comments

SPF/PC v4 for MS-DOS, FreeDOS, x86

https://github.com/moshix/SPFPC
15•hggh•1h ago•3 comments

Common drug tests lead to tens of thousands wrongful arrests a year

https://www.cnn.com/2026/04/05/us/colorado-field-drug-test-law
77•rawgabbit•4h ago•38 comments

Scientists Figured Out How Eels Reproduce (2022)

https://www.intelligentliving.co/scientists-finally-figured-out-how-eels-reproduce/
70•thunderbong•3d ago•11 comments

StackOverflow: Retiring the Beta Site

https://meta.stackoverflow.com/questions/438628/retiring-the-beta-site
18•stefankuehnel•57m ago•7 comments

Show HN: OsintRadar – Curated directory for osint tools

https://osintradar.com/
44•lexalizer•10h ago•5 comments

LLM Wiki – example of an "idea file"

https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f
255•tamnd•23h ago•77 comments