From 07e188be3ba696461d3010c9d40e3ff156f7f4d0 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Tue, 6 Jan 2015 09:47:48 +0000 Subject: adaint.c (ProcListEvt): Set to NULL. 2015-01-06 Pascal Obry * adaint.c (ProcListEvt): Set to NULL. * rtinit.c: New file. (__gnat_rt_init_count): New reference counter set to 0. (__gnat_runtime_initialize): Move code here from __gnat_initialize when this code is actually needed for the runtime initialization. This routine returns immediately if the initialization has already been done. * final.c: Revert previous change. * rtfinal.c: New file. (__gnat_runtime_finalize)[Win32]: Add finalization of the critical section and event. The default version of this routine is empty (except for the reference counting code). This routine returns immediately if some others libraries are referencing the runtime. * bindgen.adb (Gen_Adainit): Generate call to Runtime_Initialize remove circuitry to initialize the signal handler as this is now done by the runtime initialization routine. (Gen_Adafinal): Generate call to Runtime_Finalize. * gnat_ugn.texi: Update documentation about concurrency and initialization/finalization of the run-time. * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Add references to rtfinal.o and rtinit.o From-SVN: r219238 --- gcc/ada/bindgen.adb | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'gcc/ada/bindgen.adb') diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 8979b77..0a9ece0 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -390,6 +390,11 @@ package body Bindgen is Write_Statement_Buffer; end if; + WBI (""); + WBI (" procedure Runtime_Finalize;"); + WBI (" pragma Import (C, Runtime_Finalize, " & + """__gnat_runtime_finalize"");"); + WBI (""); WBI (" begin"); if not CodePeer_Mode then @@ -399,6 +404,8 @@ package body Bindgen is WBI (" Is_Elaborated := False;"); end if; + WBI (" Runtime_Finalize;"); + -- On non-virtual machine targets, finalization is done differently -- depending on whether this is the main program or a library. @@ -599,13 +606,9 @@ package body Bindgen is -- installation, and indication of if it's been called previously. WBI (""); - WBI (" procedure Install_Handler;"); - WBI (" pragma Import (C, Install_Handler, " & - """__gnat_install_handler"");"); - WBI (""); - WBI (" Handler_Installed : Integer;"); - WBI (" pragma Import (C, Handler_Installed, " & - """__gnat_handler_installed"");"); + WBI (" procedure Runtime_Initialize;"); + WBI (" pragma Import (C, Runtime_Initialize, " & + """__gnat_runtime_initialize"");"); -- Import handlers attach procedure for sequential elaboration policy @@ -835,13 +838,9 @@ package body Bindgen is -- In .NET, when binding with -z, we don't install the signal handler -- to let the caller handle the last exception handler. - if VM_Target /= CLI_Target - or else Bind_Main_Program - then + if Bind_Main_Program then WBI (""); - WBI (" if Handler_Installed = 0 then"); - WBI (" Install_Handler;"); - WBI (" end if;"); + WBI (" Runtime_Initialize;"); end if; end if; -- cgit v1.1