thread limit in python
danieldsmith at gmail.com
danieldsmith at gmail.com
Fri Aug 12 11:06:36 EDT 2005
i modified my C test program (included below) to explicitly set the
default thread stack size, and i'm still running into the same
problem. can you think of any other thing that would possibly be
limiting me?
and sorry to continue to post here. since this is occurring in both c
and python, i think there's no question i'm running into an os limit.
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <pthread.h>
void *
run (void *arg) {
sleep(1000);
}
int main(int argc, char *argv[]) {
int j;
int ret;
pthread_t tid;
int num_threads = atoi(argv[1]);
pthread_attr_t attr;
int stacksize;
pthread_attr_init(&attr);
pthread_attr_getstacksize (&attr, &stacksize);
printf("Default stack size = %d\n", stacksize);
// set stack size to 64K
pthread_attr_setstacksize (&attr, 0x10000);
pthread_attr_getstacksize (&attr, &stacksize);
printf("New stack size = %d\n", stacksize);
for (j=0; j < num_threads; j++) {
ret = pthread_create (&tid, NULL, run, NULL);
if (ret != 0) {
printf("thread create failed\n",j);
fflush(stdout);
exit(0);
}
printf("created thread %d\n",j);
fflush(stdout);
}
sleep(1000);
}
More information about the Python-list
mailing list