* include/private/gc_priv.h (GC_markers): Change type from long to int.
* mark.c (GC_markers): Likewise.
* pthread_support.c (GC_nprocs): Likewise.
* pthread_support.c (start_mark_threads, GC_thr_init): Adjust printf
format specifier for GC_markers and GC_nprocs.
* win32_threads.c (GC_thr_init): Likewise.
* pthread_support.c (GC_thr_init): Cast sysconf() result to int.
* win32_threads.c (start_mark_threads, GC_wait_marker,
GC_notify_all_marker): Remove unnecessary cast of GC_markers.
* win32_threads.c (GC_thr_init): Cast dwNumberOfProcessors to int.
/* than the main garbage collector lock; standard pthreads-based */
/* implementations should be sufficient. */
- GC_EXTERN long GC_markers; /* Number of mark threads we would like */
+ GC_EXTERN int GC_markers; /* Number of mark threads we would like */
/* to have. Includes the initiating */
/* thread. Defined in mark.c. */
#define ENTRIES_TO_GET 5
-GC_INNER long GC_markers = 2; /* Normally changed by thread-library- */
+GC_INNER int GC_markers = 2; /* Normally changed by thread-library- */
/* -specific code. */
/* Mark using the local mark stack until the global mark stack is empty */
unsigned my_id;
if (!GC_parallel) return;
+
GC_acquire_mark_lock();
while (GC_mark_no < my_mark_no
|| (!GC_help_wanted && GC_mark_no == my_mark_no)) {
GC_INNER GC_bool GC_need_to_lock = FALSE;
-STATIC long GC_nprocs = 1;
+STATIC int GC_nprocs = 1;
/* Number of processors. We may not have */
/* access to all of them, but this is as good */
/* a guess as any ... */
}
}
if (GC_print_stats) {
- GC_log_printf("Started %ld mark helper threads\n", GC_markers - 1);
+ GC_log_printf("Started %d mark helper threads\n", GC_markers - 1);
}
pthread_attr_destroy(&attr);
}
# elif defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
|| defined(GC_SOLARIS_THREADS) || defined(GC_GNU_THREADS) \
|| defined(PLATFORM_ANDROID) || defined(NACL)
- GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
+ GC_nprocs = (int)sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# elif defined(GC_IRIX_THREADS)
- GC_nprocs = sysconf(_SC_NPROC_ONLN);
+ GC_nprocs = (int)sysconf(_SC_NPROC_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# elif defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) \
|| defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS)
# ifdef PARALLEL_MARK
if (GC_print_stats) {
GC_log_printf(
- "Number of processors = %ld, number of marker threads = %ld\n",
- GC_nprocs, GC_markers);
+ "Number of processors = %d, number of marker threads = %d\n",
+ GC_nprocs, GC_markers);
}
if (GC_markers <= 1) {
GC_parallel = FALSE;
/* Adjust GC_markers (and free unused resources) in case of failure. */
# ifdef DONT_USE_SIGNALANDWAIT
- while ((int)GC_markers > i + 1) {
+ while (GC_markers > i + 1) {
GC_markers--;
- CloseHandle(GC_marker_cv[(int)GC_markers - 1]);
+ CloseHandle(GC_marker_cv[GC_markers - 1]);
}
# else
GC_markers = i + 1;
{
HANDLE event = mark_cv;
DWORD thread_id = GetCurrentThreadId();
- int i = (int)GC_markers - 1;
+ int i = GC_markers - 1;
while (i-- > 0) {
if (GC_marker_Id[i] == thread_id) {
event = GC_marker_cv[i];
GC_INNER void GC_notify_all_marker(void)
{
DWORD thread_id = GetCurrentThreadId();
- int i = (int)GC_markers - 1;
+ int i = GC_markers - 1;
while (i-- > 0) {
/* Notify every marker ignoring self (for efficiency). */
if (SetEvent(GC_marker_Id[i] != thread_id ? GC_marker_cv[i] :
# ifdef MSWINCE
/* There is no GetProcessAffinityMask() in WinCE. */
/* GC_sysinfo is already initialized. */
- GC_markers = GC_sysinfo.dwNumberOfProcessors;
+ GC_markers = (int)GC_sysinfo.dwNumberOfProcessors;
# else
# ifdef _WIN64
DWORD_PTR procMask = 0;
/* If we are using a parallel marker, actually start helper threads. */
if (GC_parallel) start_mark_threads();
if (GC_print_stats) {
- GC_log_printf("Started %ld mark helper threads\n", GC_markers - 1);
+ GC_log_printf("Started %d mark helper threads\n", GC_markers - 1);
}
# endif
}