StargateTech2 icon indicating copy to clipboard operation
StargateTech2 copied to clipboard

TileBusAdapter Thread Safety

Open Matchlighter opened this issue 11 years ago • 5 comments

The TileBusAdapter has some major thread safety issues... It is sending and processing packets on the ComputerCraft thread instead of the main thread. This is causing a crash when I try to generate a SGWorld.

The woes of not using OpenComputers... it has the option of running callbacks in the main thread...

Matchlighter avatar Jun 06 '14 07:06 Matchlighter

AFAIK you should be able to use SGTech without CC installed. Don't quote me on that though.

LizzyTrickster avatar Jun 06 '14 08:06 LizzyTrickster

you can use OpenComputers... Sangar has implemented the new API. as for thread safety, looks like I'll either have to:

  1. make a stupid workaround on the bus adapter and signal CC to get packet responses, or
  2. fuck CC support.

CC, Y U stupid?

LordFokas avatar Jun 06 '14 10:06 LordFokas

@LordFokas, need you ask that? :P

LizzyTrickster avatar Jun 06 '14 11:06 LizzyTrickster

Alright, here's how we're going to fix this:

  • save packets for a while until the next tick.
  • send all packets, in the right order on the next tick.
  • trigger a signal for each packet to hand the response back to the computer.

I also need to poke Sangar about this so he can do the same on OC's side.

LordFokas avatar Jan 27 '15 15:01 LordFokas

#103 is needed to implement this or packets may get lost between ticks.

LordFokas avatar Feb 16 '15 17:02 LordFokas