is_mp(), sysconf, and atoi. (Statically-linked multithreaded app s broken on X86?)
Mohan Embar
gnustuff@thisiscool.com
Sat Mar 8 06:24:00 GMT 2003
Hans,
I don't pretend to even have a clue as to what you're talking about, but I was
wondering what you thought of the following idiom instead of what you had
in linux-threads.c. Am I being too anal?
If you're too busy to waste time on this, I understand.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
Index: linux_threads.c
===================================================================
RCS file: /cvsroot/gcc/gcc/boehm-gc/linux_threads.c,v
retrieving revision 1.20
diff -u -2 -r1.20 linux_threads.c
--- linux_threads.c 29 Mar 2002 22:52:12 -0000 1.20
+++ linux_threads.c 8 Mar 2003 06:18:27 -0000
@@ -1022,5 +1022,12 @@
if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c'
&& stat_buf[i+2] == 'p' && stat_buf[i+3] == 'u') {
- int cpu_no = atoi(stat_buf + i + 4);
+ /* int cpu_no = atoi(stat_buf + i + 4); */
+ int cpu_no = 0;
+ const char* pchCurBufPos = stat_buf + i + 4;
+ char c;
+ while ((c = *pchCurBufPos++) >= '0' & c <= '9') {
+ cpu_no *= 10;
+ cpu_no += (c - '0');
+ }
if (cpu_no >= result) result = cpu_no + 1;
}
More information about the Java
mailing list