Re: static member variable in libcommon and double free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 27, 2016 at 8:04 AM, kefu chai <tchaikov@xxxxxxxxx> wrote:
> On Wed, Jul 27, 2016 at 10:33 AM, Patrick Donnelly <pdonnell@xxxxxxxxxx> wrote:
>> On Tue, Jul 26, 2016 at 9:54 PM, Brad Hubbard <bhubbard@xxxxxxxxxx> wrote:
>>>> I'm guessing that the source of the problem is that the AsyncMessager.cc file is included twice, one in each library. If so, then the solution is to break out the offending *.cc file into a separate third library that's linked in the right combination with the others so that there's no duplication.
>>>>
>>>
>>> I believe the problem can also be solved with a static member function or a
>>> wrapper function for the static variable. I tried this and it appears to
>>> resolve the issue.
>>
>> Another solution is to use anonymous namespaces which will force the
>> symbol to be local to the translation unit.
>
> but anonymous namespace has its own limitation, for example, we cannot use
> wrap class WorkerPool in anonymous namespace, see
> https://github.com/ceph/ceph/blob/master/src/msg/async/AsyncMessenger.cc#L308,
> as WorkerPool is forward declared in the header file.

Ah, that complicates matters. I believe you're right.

-- 
Patrick Donnelly
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux