]> granicus.if.org Git - gc/commitdiff
* linux_threads.c (GC_get_nprocs): Close file descriptor.
authorjsturm <jsturm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Mar 2002 18:08:57 +0000 (18:08 +0000)
committerguest <ivmai@mail.ru>
Fri, 29 Jul 2011 06:54:21 +0000 (10:54 +0400)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51321 138bc75d-0d04-0410-961f-82ee72b054a4

ChangeLog
linux_threads.c

index 5f1c1e121bcf8ac2335643e075dd516de64340d4..304c94a145257fb50ece23a49eb3e5b9ed9d88b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-03-25  Jeff Sturm  <jsturm@one-point.com>
+
+       * linux_threads.c (GC_get_nprocs): Close file descriptor.
+
 2002-03-21  Loren J. Rittle  <ljrittle@acm.org>
 
        * include/private/gcconfig.h: Add unified test for FreeBSD.
index b26988cef9e5d5b0158148b4b8149e9d09180c2c..0bc0f131b106b50ace796ea2ca0318e4839c58a0 100644 (file)
@@ -1015,6 +1015,7 @@ int GC_get_nprocs()
        WARN("Couldn't read /proc/stat\n", 0);
        return -1;
     }
+    close(f);
     for (i = 0; i < len - 100; ++i) {
         if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c'
            && stat_buf[i+2] == 'p' && stat_buf[i+3] == 'u') {
@@ -1358,6 +1359,9 @@ void * GC_start_routine(void * arg)
        GC_printf1("start_routine = 0x%lx\n", start);
 #   endif
     start_arg = si -> arg;
+#   ifdef DEBUG_THREADS
+        GC_printf1("sem_post from 0x%lx\n", my_pthread);
+#   endif
     sem_post(&(si -> registered));     /* Last action on si.   */
                                        /* OK to deallocate.    */
     pthread_cleanup_push(GC_thread_exit_proc, 0);
@@ -1426,6 +1430,10 @@ WRAP_FUNC(pthread_create)(pthread_t *new_thread,
         while (0 != sem_wait(&(si -> registered))) {
            if (EINTR != errno) ABORT("sem_wait failed");
        }
+#   ifdef DEBUG_THREADS
+        GC_printf1("sem_wait complete from thread 0x%X\n",
+                  pthread_self());
+#   endif
         sem_destroy(&(si -> registered));
        LOCK();
        GC_INTERNAL_FREE(si);