Implementation mising features in lock_and_signal for Win32. Also lowered the minimum stack size to get the pfib benchmark to run without exhausting its address space on Windows.
This commit is contained in:
parent
681c063ec0
commit
022ebc198b
5 changed files with 11 additions and 10 deletions
|
@ -87,6 +87,7 @@ rust_dom::malloc(size_t size, memory_region::memory_region_type type) {
|
|||
} else if (type == memory_region::SYNCHRONIZED) {
|
||||
return synchronized_region.malloc(size);
|
||||
}
|
||||
I(this, false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ rust_srv::fatal(const char *expression,
|
|||
"fatal, '%s' failed, %s:%d %s",
|
||||
expression, file, (int)line, buf);
|
||||
log(msg);
|
||||
abort();
|
||||
//exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
// FIXME (issue #151): This should be 0x300; the change here is for
|
||||
// practicality's sake until stack growth is working.
|
||||
static size_t const min_stk_bytes = 0x300000;
|
||||
// static size_t const min_stk_bytes = 0x10000;
|
||||
|
||||
//static size_t const min_stk_bytes = 0x300000;
|
||||
//static size_t const min_stk_bytes = 0x10000;
|
||||
static size_t const min_stk_bytes = 0x100000;
|
||||
|
||||
// Task stack segments. Heap allocated and chained together.
|
||||
|
||||
|
|
|
@ -41,18 +41,19 @@ lock_and_signal::~lock_and_signal() {
|
|||
void lock_and_signal::lock() {
|
||||
#if defined(__WIN32__)
|
||||
EnterCriticalSection(&_cs);
|
||||
_holding_thread = GetCurrentThreadId();
|
||||
#else
|
||||
CHECKED(pthread_mutex_lock(&_mutex));
|
||||
_holding_thread = pthread_self();
|
||||
_locked = true;
|
||||
#endif
|
||||
_locked = true;
|
||||
}
|
||||
|
||||
void lock_and_signal::unlock() {
|
||||
_locked = false;
|
||||
#if defined(__WIN32__)
|
||||
LeaveCriticalSection(&_cs);
|
||||
#else
|
||||
_locked = false;
|
||||
CHECKED(pthread_mutex_unlock(&_mutex));
|
||||
#endif
|
||||
}
|
||||
|
@ -108,8 +109,7 @@ void lock_and_signal::signal_all() {
|
|||
bool lock_and_signal::lock_held_by_current_thread()
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
// TODO: implement this functionality for win32.
|
||||
return false;
|
||||
return _locked && _holding_thread == GetCurrentThreadId();
|
||||
#else
|
||||
return _locked && _holding_thread == pthread_self();
|
||||
#endif
|
||||
|
|
|
@ -6,13 +6,14 @@ class lock_and_signal {
|
|||
#if defined(__WIN32__)
|
||||
HANDLE _event;
|
||||
CRITICAL_SECTION _cs;
|
||||
DWORD _holding_thread;
|
||||
#else
|
||||
pthread_cond_t _cond;
|
||||
pthread_mutex_t _mutex;
|
||||
|
||||
pthread_t _holding_thread;
|
||||
bool _locked;
|
||||
#endif
|
||||
bool _locked;
|
||||
public:
|
||||
lock_and_signal();
|
||||
virtual ~lock_and_signal();
|
||||
|
|
Loading…
Reference in a new issue