mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
rt: Use 100k stacks for scheduler threads
This commit is contained in:
parent
7f1ea3ef6a
commit
8e55d3130a
@ -13,13 +13,15 @@ pthread_key_t rust_task_thread::task_key;
|
||||
DWORD rust_task_thread::task_key;
|
||||
#endif
|
||||
|
||||
const size_t C_STACK_SIZE = (1024*1024);
|
||||
const size_t SCHED_STACK_SIZE = 1024*100;
|
||||
const size_t C_STACK_SIZE = 1024*1024;
|
||||
|
||||
bool rust_task_thread::tls_initialized = false;
|
||||
|
||||
rust_task_thread::rust_task_thread(rust_scheduler *sched,
|
||||
rust_srv *srv,
|
||||
int id) :
|
||||
rust_thread(SCHED_STACK_SIZE),
|
||||
ref_count(1),
|
||||
_log(srv, this),
|
||||
log_lvl(log_debug),
|
||||
|
@ -1,7 +1,13 @@
|
||||
#include "globals.h"
|
||||
#include "rust_thread.h"
|
||||
|
||||
rust_thread::rust_thread() : thread(0) {
|
||||
const size_t default_stack_sz = 1024*1024;
|
||||
|
||||
rust_thread::rust_thread() : thread(0), stack_sz(default_stack_sz) {
|
||||
}
|
||||
|
||||
rust_thread::rust_thread(size_t stack_sz)
|
||||
: thread(0), stack_sz(stack_sz) {
|
||||
}
|
||||
|
||||
rust_thread::~rust_thread() {
|
||||
@ -23,11 +29,11 @@ rust_thread_start(void *ptr) {
|
||||
void
|
||||
rust_thread::start() {
|
||||
#if defined(__WIN32__)
|
||||
thread = CreateThread(NULL, 0, rust_thread_start, this, 0, NULL);
|
||||
thread = CreateThread(NULL, stack_sz, rust_thread_start, this, 0, NULL);
|
||||
#else
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, 1024 * 1024);
|
||||
pthread_attr_setstacksize(&attr, stack_sz);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||
pthread_create(&thread, &attr, rust_thread_start, (void *) this);
|
||||
#endif
|
||||
|
@ -5,13 +5,17 @@
|
||||
* Thread utility class. Derive and implement your own run() method.
|
||||
*/
|
||||
class rust_thread {
|
||||
public:
|
||||
private:
|
||||
#if defined(__WIN32__)
|
||||
HANDLE thread;
|
||||
#else
|
||||
pthread_t thread;
|
||||
#endif
|
||||
size_t stack_sz;
|
||||
public:
|
||||
|
||||
rust_thread();
|
||||
rust_thread(size_t stack_sz);
|
||||
virtual ~rust_thread();
|
||||
|
||||
void start();
|
||||
|
Loading…
Reference in New Issue
Block a user