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
Make thread stack size runtime tunable #43062
Comments
Platform default thread stack sizes vary considerably. Some platforms have restricted virtual address space Some applications have a thirst for stack space in The current approach to stack space management in This patch is intended to allow developers some control An alternative approach to providing the functionality The patch has been tested on OS/2 and FreeBSD 4.8. I While I would like to see this functionality in Python Critique of the approach and implementation welcome. |
Logged In: YES I'm all for this! The FreeBSD port have maintained a local BTW, the naming, "thread.stack_size" seems to miss a verb |
Logged In: YES Thanks for the comments. As implemented, the function is both a getter and I chose this approach to make it a little simpler to support old_size = thread.stack_size(new_size)
...
thread.stack_size(old_size) vs old_size = thread.stack_size
thread.stack_size = new_size
...
thread.stack_size = old_size or (using get/set accessors) old_size = thread.get_stacksize()
thread.set_stacksize(new_size)
...
thread.set_stacksize(old_size) I think an argument can be made for passing on the I don't believe that the functionality belongs anywhere else |
Logged In: YES Usage of pthread_attr_setstacksize should be conditional on I think PTHREAD_STACK_MIN should be considered. The documentation should list availibility of the feature, Apart from that, the patch looks fine. |
Logged In: YES
I'm also putting together an environment variable only Thanks for the comments. |
Logged In: YES re 1) Currently, the usage of the stacksize attribute is re 2) I can accept that Python enforces a minimum above -1 for an environment variable version. What problem would |
Logged In: YES I have updated the patch along the lines Martin suggested. I have omitted OS/2 from the list of supported platforms in The idea with the environment variable version was that it |
Logged In: YES The patch applies cleanly on WinXP, "and works" (I checked Note that Python C style for defining functions puts the """
static int
_pythread_nt_set_stacksize(size_t size)
""" instead of """
static int _pythread_nt_set_stacksize(size_t size)
""" The patch isn't consistent about this, and perhaps it's This should really be exposed via threading.py. |
Logged In: YES Thanks Tim. My default action is to try and match the prevailing style, As an "implementation detail", I hadn't considered that I can see 2 approaches:
Any hints on which would be the more preferable or natural |
Logged In: YES Right, this one: "a simple shadow of the function as a Sticking "stack_size" in threading.__all__, and adding from thread import stack_size to threading.py is all I'm looking for here. Well, plus |
Logged In: YES Ok, v3 includes the additions to the threading module, tests If there are no other issues needing to be addressed, I |
Logged In: YES Checked in to trunk after further revision in r46919, with |
Logged In: YES This Tracker item was closed automatically by the system. It was |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: