lunasorcery

as seen on cohost!

30-something poly kinky queer mess
recovering former game dev
dating: @estrogen-and-spite & @RobinProblem


personal blog (with rss!)
moonbase.lgbt/
other website
tiredand.gay/

threads are good actually

how i was doing the thing

10 read from a serial port
20 do a small amount of work with that data
30 if a certain magic value was read, then
40 do a lot more processing, including but not limited to polling a GPS chip
50 end if
60 goto 10

turns out if the processing takes too long (which it was) this is liable to just miss a whole buncha events from the serial port (which is bad)

how i'm doing the thing now

  • thread which polls the GPS chip and puts the latest location into a mutable global (ew)
  • thread which reads from the serial port and sends messages into a channel
  • thread which receives from that channel and does the actual work, including reading that global mutable GPS state

You must log in to comment.