Please report new issues athttps://github.com/DOCGroup
If ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER is set, the Naming Service does not work, because you have to call ACE::init and ACE::fini. Here a possible solution for Naming_Server.cpp: int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { //************************************************************************ // Patch: if ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER // we have to instantiate the Object_Manager //************************************************************************ #if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) (void)ACE::init(); { // Reason for this scope --> see at the end of this scope #endif //************************************************************************ // Patch part 1 finished //************************************************************************ TAO_Naming_Service naming_service; // Stuff to insure that we're gracefully shut down... Naming_Svc_Shutdown killer (naming_service); Service_Shutdown kill_contractor(killer); if (naming_service.init (argc, argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("Failed to start the Naming Service.\n")), 1); try { naming_service.run (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("NamingService"); return 1; } naming_service.fini (); //************************************************************************ // Patch: if ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER // we have to shut down ACE library services //************************************************************************ #if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) } // This scope is needed, that the things are cleaned up before ACE::fini() (void)ACE::fini(); #endif //************************************************************************ // Patch finished //************************************************************************ return 0; }
Why do you set this define at all?
We use a Xenomai patched Linux which shadows Posix threads within a co-scheduler. At least some versions of Xenomai require to register the main thread at this co scheduler prior to requesting services like mutexes. The Object Manager uses mutex services.
Ok, but I don't think it is an option to change all thousands of executables in ACE/TAO to use your patch. I think you should check ace/OS_main.h/cpp, extend it with a special definition of main where ACE::init()/fini() are explicitly called, like on windows.
I think it is no solution to extend ACE_TMAIN with ACE::init()/fini() because then again I have no control of ACE::init()/fini() in my applications.
If you need control then I think you should make your own naming_service executable (or embed it into your process) instead of adding this to the core one. Seems to me that you also don't have control to the naming service when you do this
No, I don't need the control in the Naming Service. I just want the Naming Service to run. But I want the control of ACE::init()/fini() in my application. To get this control I set ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER. And with this setting the Naming Service (and I think other services too) does not work. I think this is a bug.
(In reply to comment #6) > No, I don't need the control in the Naming Service. I just want the Naming > Service to run. But I want the control of ACE::init()/fini() in my application. > To get this control I set ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER. And > with this setting the Naming Service (and I think other services too) does not > work. I think this is a bug. > The solution would be to redefine ACE_TMAIN so that we then call init()/fini() as part of main, doing this in each executable is not an option. But, you say that when we redefine ACE_TMAIN it gives again problems for you. So, we can put effort in redefining ACE_TMAIN but that seems only time consuming and not helping anyone
Ok, new suggestion: Extend ACE_TMAIN and provide macros to add lines before ACE::init() and after ACE::fini(). Something like that: # define ACE_TMAIN \ ace_main_i (int, ACE_TCHAR *[]); /* forward declaration */ \ int main (int argc, char *argv[]) { \ int RetVal = 0; \ ACE_Argv_Type_Converter wide_argv (argc, argv); \ # if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) \ # if defined (ACE_LINES_BEFORE_ACE_INIT) \ ACE_LINES_BEFORE_ACE_INIT \ # endif \ (void)ACE::init(); \ { \ # endif \ RetVal = ace_main_i (argc, wide_argv.get_TCHAR_argv ()); \ # if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) \ } \ (void)ACE::fini(); \ # if defined (ACE_LINES_AFTER_ACE_FINI) \ ACE_LINES_AFTER_ACE_FINI \ # endif \ # endif \ return RetVal \ } \ int ace_main_i
Can you provide a unified diff based on x.6.4 that adds this?
back to reporter
Created attachment 975 [details] possible solution
Created attachment 976 [details] possible solution as diff