View mode: basic / threaded / horizontal-split · Log in · Help
September 25, 2012
Runtime termination hook?
Is there an event that I can hook into which is called when the runtime 
is terminated?

-- 
/Jacob Carlborg
September 26, 2012
Re: Runtime termination hook?
On Sep 25, 2012, at 12:44 PM, Jacob Carlborg <doob@me.com> wrote:

> Is there an event that I can hook into which is called when the runtime is terminated?

A shared static dtor?
September 26, 2012
Re: Runtime termination hook?
On 2012-09-26 07:37, Sean Kelly wrote:

> A shared static dtor?

Didn't think of that. When exactly are those run? I'm looking for 
something corresponding to this Java method:

http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29

-- 
/Jacob Carlborg
September 27, 2012
Re: Runtime termination hook?
On Wed, 26 Sep 2012 02:16:31 -0400, Jacob Carlborg <doob@me.com> wrote:

> On 2012-09-26 07:37, Sean Kelly wrote:
>
>> A shared static dtor?
>
> Didn't think of that. When exactly are those run?

https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L319

-Steve
September 27, 2012
Re: Runtime termination hook?
On Thu, 27 Sep 2012 08:03:39 -0400, Steven Schveighoffer  
<schveiguy@yahoo.com> wrote:

> On Wed, 26 Sep 2012 02:16:31 -0400, Jacob Carlborg <doob@me.com> wrote:
>
>> On 2012-09-26 07:37, Sean Kelly wrote:
>>
>>> A shared static dtor?
>>
>> Didn't think of that. When exactly are those run?
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L319

I guess here too:

https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L549

-Steve
September 27, 2012
Re: Runtime termination hook?
On 2012-09-27 14:04, Steven Schveighoffer wrote:

> I guess here too:
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L549

Yeah, I guess that looks close enough. BTW, "main" should really use 
"rt_term" and "rt_init" instead of duplicating the code.

-- 
/Jacob Carlborg
Top | Discussion index | About this forum | D home