diff options
author | Geoff Norton <grompf@gmail.com> | 2011-08-03 05:45:49 +0400 |
---|---|---|
committer | Geoff Norton <grompf@gmail.com> | 2011-08-03 05:45:49 +0400 |
commit | 7f799370ec85fb9d5a539b05b084eae4ca6956ed (patch) | |
tree | 459f291ae73108d880a3118781c8572211bc0dd0 /libgc/pthread_support.c | |
parent | 5fc5f02c461b45fdf562993591289ea003578ec4 (diff) |
[gc] Darwin/AMD64 can have 64-bit thread id's, so we need to ensure
we cast properly to make sure the modulus has a valid result.
Additionally add support for x86_THREAD_STATE64.
Diffstat (limited to 'libgc/pthread_support.c')
-rw-r--r-- | libgc/pthread_support.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libgc/pthread_support.c b/libgc/pthread_support.c index 3e588ace211..96e8a011b2c 100644 --- a/libgc/pthread_support.c +++ b/libgc/pthread_support.c @@ -729,7 +729,7 @@ void nacl_shutdown_gc_thread() /* Caller holds allocation lock. */ GC_thread GC_new_thread(pthread_t id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; GC_thread result; static GC_bool first_thread_used = FALSE; @@ -760,7 +760,7 @@ GC_thread GC_new_thread(pthread_t id) /* Caller holds allocation lock. */ void GC_delete_thread(pthread_t id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; @@ -796,7 +796,7 @@ void GC_delete_thread(pthread_t id) /* This is OK, but we need a way to delete a specific one. */ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; register GC_thread prev = 0; @@ -825,7 +825,7 @@ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id) /* return the most recent one. */ GC_thread GC_lookup_thread(pthread_t id) { - int hv = ((word)id) % THREAD_TABLE_SZ; + int hv = ((unsigned long)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; while (p != 0 && !pthread_equal(p -> id, id)) p = p -> next; |