Open
Conversation
Collaborator
|
Is Some quick googling suggests:
|
daurnimator
reviewed
Nov 5, 2018
src/thread.c
Outdated
| } | ||
| lua_pushstring(L, buf); | ||
| return 1; | ||
| } /* ct_setname() */ |
Author
|
Oh, you're right, that's quite a mess. I've added checks to explicitly support the relevant functions on Linux, the BSDs and OS X. |
daurnimator
requested changes
Nov 6, 2018
Collaborator
daurnimator
left a comment
There was a problem hiding this comment.
Note that config.h.guess is from the autoguess project (https://github.com/wahern/autoguess/).
You may want to send your changes there?
| #if HAVE_PTHREAD_SETNAME | ||
| static int ct_setname(lua_State *L) { | ||
| struct cthread *ct = ct_checkthread(L, 1); | ||
| char *name = luaL_checkstring(L, 2); |
Collaborator
There was a problem hiding this comment.
there is too much whitespace here.
| #elif HAVE_MACOSX_PTHREAD | ||
| if (pthread_equal(ct->id, pthread_self())) { | ||
| lua_pushboolean(L, 0); | ||
| lua_pushliteral(L, "thread name cannot be set from outside the thread on this platform"); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
daurnimator
reviewed
Dec 4, 2024
Comment on lines
+786
to
+805
| switch(rc) { | ||
| case 0: | ||
| lua_pushboolean(L, 1); | ||
| return 1; | ||
| case ERANGE: | ||
| lua_pushboolean(L, 0); | ||
| lua_pushliteral(L, "thread name too long"); | ||
| lua_pushinteger(L, rc); | ||
| return 3; | ||
| case EINVAL: | ||
| lua_pushboolean(L, 0); | ||
| lua_pushliteral(L, "invalid parameter when setting thread name"); | ||
| lua_pushinteger(L, rc); | ||
| return 3; | ||
| case ENOMEM: | ||
| lua_pushboolean(L, 0); | ||
| lua_pushliteral(L, "out of memory when setting thread name"); | ||
| lua_pushinteger(L, rc); | ||
| return 3; | ||
| } |
Collaborator
There was a problem hiding this comment.
And what if rc is something else: needs a default option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds wrappers for
pthread_setname_npandpthread_getname_npto the thread metatable. It's quite useful to be able to name long-running threads!