home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,712 of 33,346   
   Pete Becker to kelvSYC   
   Re: Segmentation fault when accessing me   
   01 Dec 11 17:09:43   
   
   54bd59f0   
   From: pete@versatilecoding.com   
      
   On 2011-12-01 03:35:41 +0000, kelvSYC said:   
      
   > I'm having this weird problem where I am segfaulting whenever I try to   
   > access a member of my class:   
   >   
   > class LookupTable {   
   >     typedef boost::upgrade_lock ReadLock;   
   >     typedef boost::upgrade_to_unique_lock WriteLock;   
   > public:   
   >     unsigned long query(unsigned int k, const Evaluator& eval) {   
   >         // accessing results or mutex in any way segfaults here   
   >     }   
   > private:   
   >     std::map results;   
   >     boost::shared_mutex mutex;   
   > };   
   >   
   > Another similar class (a class that manages LookupTable instances) has   
   > a similar structure (in terms of its similarities with query()), but   
   > doesn't segfault.  Any thoughts as to be why this could happen?   
      
   Usually caused by a bad pointer. Does the object that you're calling   
   this function on actually exist?   
      
   --   
    Pete   
   Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The   
   Standard C++ Library Extensions: a Tutorial and Reference   
   (www.petebecker.com/tr1book)   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca