|
Boost Users : |
Subject: Re: [Boost-users] shared_lock ( ) causes Segmentation Fault in CentOS 5.5 x64?
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2011-03-16 09:00:15
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, March 16, 2011, Zap wrote:
> I just tested a simple case,
> which just lock the read lock and print out the result
> of tablePush.size(), like this:
>
> bool getFD(list<int> *des, char *type, char *code){
> bool flag=false;
> boost::shared_lock<boost::shared_mutex> lock(rwMutex);
> cout<<tablePush[pair<string, string>(type, code)].size()<<endl;
> return flag;
> }
>
> but it still happens Segmentation Fault...
>
> could anyone know what's the problem is?
operator[] on maps can modify the map. Maybe you want to use find() instead?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk2AtF8ACgkQ5vihyNWuA4U8dwCgqo2WMSY9JLSbNL8x1je8Qd2Y
XtEAoLkH9S0m9LE8nMH4idirsz2UsNi3
=TB03
-----END PGP SIGNATURE-----
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net