HTCondor Project List Archives



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

Re: [Condor-devel] daemonCore instance in DaemonCore class



On 01/27/2010 09:19 AM, Marc Tardif wrote:
> * Matthew Farrellee <matt@xxxxxxxxxx> [2010-01-26 21:28 -0500]:
>> On 01/19/2010 09:33 PM, Marc Tardif wrote:
>>> I noticed that the DaemonCore member functions sometimes call the
>>> global daemonCore instance directly instead of calling the "this"
>>> instance. For example, in DaemonCore::Close_FD:
>>>
>>>   retval = ( daemonCore->Close_Pipe ( fd ) ? 0 : -1 );
>>>
>>> So, I was wondering under what circumstances both the global daemonCore
>>> instance differed from the "this" instance. It seems an example of this
>>> can be found in the main function in daemon_core_main.cpp. However, I'm
>>> still not quite sure I understand why there is a need for having two
>>> such instances co-existing. Can someone provide a little explanation?
>>
>> I'd take the silence to mean no one knows off the top of their
>> heads. It's entirely possible this is just an artifact of age that
>> could be made more consistent.
>>
>> Off the top of my head, I'd say maybe some functions only have access
>> to the static context and must use daemonCore.
> 
> In the above example, DaemonCore::Close_FD is a member function
> of DaemonCore, so I'm not sure how it might only have access to the
> static context rather than the "this" pointer. As you say, perhaps this
> is an artifact of a function written in C which accessed the static
> context and was not updated to use "this" when copied over to a C++
> member function. This would make sense in a C context because using
> a global instance of the daemon core structure would've probably been
> more convenient than passing the structure as argument to every daemon
> core function.
> 

If you find that this can be used in place for the global daemonCore instance, feel free to send back a patch that adds consistency.

Best,


matt