Skip to content

Which internals call os.pullEventRaw? #1849

Answered by SquidDev
Zirunis asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest thing here may be to add a print(debug.traceback()) call to your function, and see where these are coming from.

CraftOS doesn't run your program directly, but goes through several layers of coroutines, in order for things to run in parallel. Off the top of my head, you'll have:

  • The bios calls parallel.waitForAny, whose loop will pull events.
  • That runs rednet.run in parallel, which also pulls events.
  • On advanced computers, multishell adds another layer of coroutines, and so another pullEventRaw.
  • Finally, the shell runs each program in its own coroutine, so that's one more event pull.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Zirunis
Comment options

@SquidDev
Comment options

Answer selected by Zirunis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants