Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.

fix os.sleep(0) causing too long without yielding - #3779

Merged
asiekierka merged 1 commit into
MightyPirates:master-MC1.7.10from
Ocawesome101:patch-3
May 31, 2025
Merged

asiekierka merged 1 commit into
MightyPirates:master-MC1.7.10from
Ocawesome101:patch-3

Conversation

@Ocawesome101

Copy link
Copy Markdown
Contributor

It appears commit 7fecb07 broke os.sleep(0):

while true do os.sleep(0) end

as of oc 1.8.7/1.8.8 this cannot be interrupted, and will crash with too long without yielding, where in 1.8.6 and before this was not the case. may fix #3773

@TheRedCreations

Copy link
Copy Markdown

Hi. AGS-Dev here.
You are right about the broken os.sleep(). I just changed the os.sleep() to os.sleep(0.1) and the program works again.
Thank you.

@ff66theone

Copy link
Copy Markdown
Contributor

Why not using os.sleep(0.05) since a Minecraft ticks lasts 1/20 of a second (0.05s) ?
I know it only gains 0.05 seconds, but that's nearer from the pre-1.8.6 version.

@TheRedCreations

Copy link
Copy Markdown

I got told that 0.05 wouldn't work and 0.1 is minimum. but it works with 0.05 too.
Maybe i change that, or leave it as it is cause its only 0.05 difference.

@asiekierka
asiekierka merged commit 76d7abe into MightyPirates:master-MC1.7.10 May 31, 2025
@zeng-github01

Copy link
Copy Markdown

This is great, I have an unattended program that has this problem and it will definitely trigger this problem after running for a long time.

I use OC to control the reactor, and this problem has caused my reactor to melt down many times.

Thank you so much

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Asking community for help with debugging and fixing .lua script that crashes on new version of OC

5 participants