Closed SangManLINUX closed 7 years ago
As always I need your oc version to provide further support. You have [1.11.2] in the title, which is partially helpful.
The thread api is wholly isolated to openos and is not affected by any other mods, no reason to test by removing mods.
Secondly, the thread api is fairly new and I would consider it in a 1.0 state. Better than alpha and beta, but not well baked.
Thirdly, I recently made some important fixes to the thread api, please download our latest dev builds: http://ci.cil.li/job/OpenComputers-dev-MC1.11/
-- the documentation doesnt always need tobe right depending what version your using it helps to mention witch version your using if you want a specific answer. -- thread api barely works. least for 1.7.10/openos 6.1/6.2
what does work if you want to multitask? coroutines and event style like functions and timers
woah woah ... i disagree with your comment a bit
"That's basically the only thing that works if you want to multitask" -- is false, threads are pretty amazing and I will continue to improve them when people find any issue with them. Sure they are new, but I will definitely continue to improve them
Note that when I say threads are at a "1.0 state" I am including the recent patch. The first builds with the thread api had many issues that I've worked out. I have no known issues with the thread api at this time
for 1.7.10 it never did openos 6.1/6.2 crazy things i did trying to make it work.. i feel attacked.
I apologize, I don't want anyone to feel attacked. I only felt it was important to correct the conversation and not give the impression that threads can't be used. Threads are great, and I am fully committed to making them reliable and amazing.
But can you [ @purplemonday ] help me understand what you meant?
for 1.7.10 it never did openos 6.1/6.2
What is "it", and what did it never do? Does this mean
crazy things i did trying to make it work
And very important -- what type of application were you trying to make? I would be interested in measuring the thread api against your use case -- this discussion could perhaps help me improve the thread model I built for openos
@SangManLINUX also, i would need some sample code that repro's this problem thanks
I'm sorry about that i forgot to mention the version of OpenComputers i downloaded from Curse. It's OpenComputers-MC1.11.2-1.7.0.40.jar
According your advise, i downloaded newer version of OpenComputers from jenkins. Now it's OpenComputers-MC1.11.2-1.7.0.44.jar
Finally now i can see that thread api is working well as doc said.
The wired problem that i saw is with example code from your doc. http://ocdoc.cil.li/_export/code/api:thread?codeblock=8
This code makes output below before. But with newer version it's worked as doc said. /// start outside thread create after suspend after resume ///
Another example is. http://ocdoc.cil.li/_export/code/api:thread?codeblock=14
This code makes output below before. But now it's working well. /// before sleep suspended suspended after resume running -- and the program never end ///
I think this example's output in doc should be modified. Because the child thread's resume is too fast so main thread can not get the child thread's death. I saw the child thread is dead by adding os.sleep() in main thread code. And also there is no "after sleep".
"But with newer version it's worked as doc said", and "But now it's working well" So it sounds like this bug can be closed?
I've also retested the code samples you linked on our latest builds and I can confirm that they work as documented.
I think this example's output in doc should be modified. Because the child thread's resume is too fast so main thread can not get the child thread's death. I saw the child thread is dead by adding os.sleep() in main thread code. And also there is no "after sleep".
Yes, but that was before the latest build which fixes this. I also added more sleeps and I confirmed it correctly prints the "after sleep"
Thank you for your attention.
I am always thankful for your mod.
Happy modding.
Hi. I'm a humble coder and also a fan of OpenComputers.
I was followed some document below here. http://ocdoc.cil.li/api:thread
After i read and follow this document by typing Lua code in minecraft, i encountered weird situation. Several functions make thread go to sleep and never wake up, for example os.sleep() and t:suspend(). So i tried to make clean minecraft modpack that includes only Minecraft, OpenComputers and Immersive Engineering for the power, but it happened same thing...
What is the problem? I wonder.