-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting access to lua thread objects #39
Comments
It can be introspected with debug.* functions. Fixes wahern#39
I had a go at adding this feature tonight. over on a branch: https://github.com/daurnimator/cqueues/commits/thread-on-error |
It can be introspected with debug.* functions. Fixes wahern#39
On Sun, Jan 11, 2015 at 08:34:26PM -0800, daurnimator wrote:
One of the TODO items I had in mind was to tweak cqueues:wrap and The actual thread object is an obvious choice, but what if we want to But maybe that's not a particularly useful feature. It also conflicts with Your patch still works, but if something like the above was implement we |
Well that doesn't work with Reusing threads with
Does it? You cannot recycle a thread that has had an error, it is The actual 'thread' object is required, as I will want to be able to use it with the
I think returning the thread in the |
Any more thoughts here? |
I'm sold. Only question mark is what the return signature should be for :step. Should it be local ok, errmsg, errno, thr = loop:step() or local ok, errmsg, errno_or_thr = loop:step() or something else? Some errors might not be related to a specific thread. Or a thread error might have an associated errno. |
Hmm, I didn't think about errno. at least in the handler I modified in my branch I didn't see it...
How would that occur? |
Infact, are there any circumstances where |
Right now, no. But that's because we either throw on error, or discard the errno after formatting the error message. Even if we return the thread, some of those thread errors involve a system error that we would want to return directly so the user doesn't have to parse the message. I'm thinking maybe the return signature should look like: local ok, msg, errno, thr = loop:step() or even local ok, msg, errno, thr, obj = loop:step() were The most common error will likely be en error thrown by the thread itself, in which case errno will be |
So lets add it if we think it's reasonable. Should be
Lets go with the former for now. we can add the poll object later if it seems to be required. |
When an error occurs (e.g. inside a
:step()
), it would be nice to be able to inspect the failed thread.One method of doing this would be returning the thread (coroutine) object from
:step()
on failure (3rd return value).The text was updated successfully, but these errors were encountered: