Revision: 53448
          http://brlcad.svn.sourceforge.net/brlcad/?rev=53448&view=rev
Author:   brlcad
Date:     2012-11-04 07:21:20 +0000 (Sun, 04 Nov 2012)
Log Message:
-----------
revert r52479 that converted if_ogl to libbu memory management.  this caused a 
semaphore deadlock for rt where it had already acquired a BU_SEM_SYSCALL 
semaphore prior to the fb_open() call.  this is the second time a conversion to 
libbu caused a race -- need to adjust the locking api to avoid this recurring 
problem (and need to rework libfb to allow internal locks).

Revision Links:
--------------
    http://brlcad.svn.sourceforge.net/brlcad/?rev=52479&view=rev

Modified Paths:
--------------
    brlcad/trunk/TODO
    brlcad/trunk/src/libfb/if_ogl.c

Modified: brlcad/trunk/TODO
===================================================================
--- brlcad/trunk/TODO   2012-11-04 05:58:40 UTC (rev 53447)
+++ brlcad/trunk/TODO   2012-11-04 07:21:20 UTC (rev 53448)
@@ -61,6 +61,9 @@
 THESE ARE UNSCHEDULED BACKLOG TASKS
 -----------------------------------
 
+* make libfb parallel-safe.  use bu memory management.  remove
+  semaphore locks in src/rt/main.c and elsewhere.
+
 * eliminate the need for bu_semaphore_init().  allocate up to the
   index requested on demand (so we can retain O(1) lookups) and
   reserve the first N semaphores for BRL-CAD library use.  change

Modified: brlcad/trunk/src/libfb/if_ogl.c
===================================================================
--- brlcad/trunk/src/libfb/if_ogl.c     2012-11-04 05:58:40 UTC (rev 53447)
+++ brlcad/trunk/src/libfb/if_ogl.c     2012-11-04 07:21:20 UTC (rev 53448)
@@ -551,7 +551,7 @@
        pixsize = ifp->if_height * ifp->if_width * sizeof(struct ogl_pixel);
        size = pixsize + sizeof(struct ogl_cmap);
 
-       sp = bu_calloc(1, size, "alloc mem");
+       sp = calloc(1, size);
        if (sp == 0) {
            fb_log("ogl_getmem: frame buffer memory malloc failed\n");
            goto fail;
@@ -577,7 +577,8 @@
     /* First try to attach to an existing one */
     if ((SGI(ifp)->mi_shmid = shmget(SHMEM_KEY, size, 0)) < 0) {
        /* No existing one, create a new one */
-       if ((SGI(ifp)->mi_shmid = shmget(SHMEM_KEY, size, IPC_CREAT|0666)) < 0) 
{
+       if ((SGI(ifp)->mi_shmid = shmget(
+                SHMEM_KEY, size, IPC_CREAT|0666)) < 0) {
            fb_log("ogl_getmem: shmget failed, errno=%d\n", errno);
            goto fail;
        }
@@ -604,7 +605,7 @@
     return 0;
 fail:
     fb_log("ogl_getmem:  Unable to attach to shared memory.\n");
-    if ((sp = bu_calloc(1, size, "alloc mem")) == NULL) {
+    if ((sp = calloc(1, size)) == NULL) {
        fb_log("ogl_getmem:  malloc failure\n");
        return -1;
     }
@@ -1162,11 +1163,11 @@
      * addressed by SGI(ifp)->mi_xxx and OGL(ifp)->xxx
      */
 
-    if ((SGIL(ifp) = (char *)bu_calloc(1, sizeof(struct sgiinfo), "alloc 
SGIL")) == NULL) {
+    if ((SGIL(ifp) = (char *)calloc(1, sizeof(struct sgiinfo))) == NULL) {
        fb_log("fb_ogl_open:  sgiinfo malloc failed\n");
        return -1;
     }
-    if ((OGLL(ifp) = (char *)bu_calloc(1, sizeof(struct oglinfo), "alloc 
OGLL")) == NULL) {
+    if ((OGLL(ifp) = (char *)calloc(1, sizeof(struct oglinfo))) == NULL) {
        fb_log("fb_ogl_open:  oglinfo malloc failed\n");
        return -1;
     }
@@ -1404,11 +1405,11 @@
      * addressed by SGI(ifp)->mi_xxx and OGL(ifp)->xxx
      */
 
-    if ((SGIL(ifp) = (char *)bu_calloc(1, sizeof(struct sgiinfo), "alloc 
SGIL")) == NULL) {
+    if ((SGIL(ifp) = (char *)calloc(1, sizeof(struct sgiinfo))) == NULL) {
        fb_log("fb_ogl_open:  sgiinfo malloc failed\n");
        return -1;
     }
-    if ((OGLL(ifp) = (char *)bu_calloc(1, sizeof(struct oglinfo), "alloc 
OGLL")) == NULL) {
+    if ((OGLL(ifp) = (char *)calloc(1, sizeof(struct oglinfo))) == NULL) {
        fb_log("fb_ogl_open:  oglinfo malloc failed\n");
        return -1;
     }
@@ -1531,15 +1532,15 @@
            }
        } else {
            /* free private memory */
-           bu_free(ifp->if_mem, "free mem");
+           (void)free(ifp->if_mem);
        }
        /* free state information */
-       bu_free((char *)SGIL(ifp), "free SGIL");
+       (void)free((char *)SGIL(ifp));
        SGIL(ifp) = NULL;
     }
 
     if (OGLL(ifp) != NULL) {
-       bu_free((char *)OGLL(ifp), "free OGLL");
+       (void)free((char *)OGLL(ifp));
        OGLL(ifp) = NULL;
     }
 
@@ -1637,15 +1638,15 @@
            }
        } else {
            /* free private memory */
-           bu_free(ifp->if_mem, "free mem");
+           (void)free(ifp->if_mem);
        }
        /* free state information */
-       bu_free((char *)SGIL(ifp), "free SGIL");
+       (void)free((char *)SGIL(ifp));
        SGIL(ifp) = NULL;
     }
 
     if (OGLL(ifp) != NULL) {
-       bu_free((char *)OGLL(ifp), "free OGLL");
+       (void)free((char *)OGLL(ifp));
        OGLL(ifp) = NULL;
     }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to