Commit 01ae20e9 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Cleanup

parent cd11e1d5
......@@ -27,8 +27,6 @@
#include "core/thread_utils.h"
#include "core/util.h"
extern "C" int start_thread(void* arg);
namespace pyston {
namespace threading {
......@@ -64,6 +62,7 @@ struct ThreadStateInternal {
};
static std::unordered_map<pid_t, ThreadStateInternal> saved_thread_states;
// TODO could optimize these by keeping a __thread local reference to current_threads[gettid()]
void* getStackBottom() {
return current_threads[gettid()].stack_bottom;
}
......@@ -282,15 +281,9 @@ static void* find_stack() {
return NULL; /* not found =^P */
}
intptr_t call_frame_base;
void registerMainThread() {
LOCK_REGION(&threading_lock);
// Would be nice if we could set this to the pthread start_thread,
// since _thread_start doesn't always show up in the traceback.
// call_frame_base = (intptr_t)::start_thread;
call_frame_base = (intptr_t)_thread_start;
current_threads[gettid()] = ThreadInfo{
.stack_bottom = find_stack(), .pthread_id = pthread_self(),
};
......
......@@ -28,12 +28,9 @@ class Box;
namespace threading {
// returns a thread id (currently, the pthread_t id)
intptr_t start_thread(void* (*start_func)(Box*, Box*, Box*), Box* arg1, Box* arg2, Box* arg3);
// The base of the call frame stack for a thread;
// useful for knowing when to stop unwinding.
extern intptr_t call_frame_base;
void registerMainThread();
struct ThreadState {
......@@ -53,10 +50,12 @@ struct ThreadState {
// as a corollary, this thread is very much not thread safe.
std::vector<ThreadState> getAllThreadStates();
// Get the stack "bottom" (first pushed data; for stacks that grow down, will
// be the highest address).
// Get the stack "bottom" (ie first pushed data. For stacks that grow down, this
// will be the highest address).
void* getStackBottom();
#ifndef THREADING_USE_GIL
#define THREADING_USE_GIL 1
#define THREADING_USE_GRWL 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment