Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
TheEisbaer

Copied over parallel API from CC, trying to get it working

Question

9 answers to this question

Recommended Posts

  • 0

I'm no expert in libraries or coroutines, though the way you have the library set up is incorrect for OC.

 

Fixed:

 

http://pastebin.com/21vvAxUh

 

Note that all I did was make it so OC recognises the library and require() returns a table of functions instead of a boolean. I can't guarantee that the code that pre-existed works. I don't really know much about coroutines. Try it out and notice my changes, see if it works.

Link to post
Share on other sites
  • 0

Also, computer.pullSignal skips over all user created coroutines

Just curious, what exactly do you mean with that? Coroutines aren't like threads, Lua doesn't automatically run them concurrently. Logically if you call computer.pullSignal in one coroutine, that will block all execution, even if you have some kind of "manual threading" (Plan9k).

Link to post
Share on other sites
  • 0

Just curious, what exactly do you mean with that? Coroutines aren't like threads, Lua doesn't automatically run them concurrently. Logically if you call computer.pullSignal in one coroutine, that will block all execution, even if you have some kind of "manual threading" (Plan9k).

OpenComputer wraps calls to coroutine.yield and coroutine.resume so that they can bubble sysyields. It's part of how OC handles component methods. (if you want to look at the code that does the yielding stuff you can check here )

Link to post
Share on other sites
  • 0

OpenComputer wraps calls to coroutine.yield and coroutine.resume so that they can bubble sysyields. It's part of how OC handles component methods. (if you want to look at the code that does the yielding stuff you can check here )

Yes, I "knew" that (i. e. I read that piece of code once before). Though I don't understand how this relates to computer.pullSignal and "skipping" coroutines.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.