EXTRA_ARRAY_VAL /usr/lib/libdali-toolkit.so
EXTRA_ARRAY_VAL /usr/lib/libcairo.so.2
EXTRA_ARRAY_VAL /usr/lib/libefl-assist.so.0
+HYDRA ON
dispose();
}
-int CoreRuntime::initialize(bool standalone)
+int CoreRuntime::preinitialize(bool standalone)
{
// checkInjection checks dotnet-launcher run mode
// At the moment, this mechanism is used only when the Memory Profiler is started.
return -1;
}
- if (__enableLogManager) {
- if (initializeLogManager() < 0) {
- _ERR("Failed to initnialize LogManager");
- return -1;
- }
-
- if (redirectFD() < 0) {
- _ERR("Failed to redirect FD");
- return -1;
- }
-
- if (runLoggingThread() < 0) {
- _ERR("Failed to create and run logging thread to redicrect log");
- return -1;
- }
- }
-
std::string libCoreclr(concatPath(getRuntimeDir(), "libcoreclr.so"));
__coreclrLib = dlopen(libCoreclr.c_str(), RTLD_NOW | RTLD_LOCAL);
_INFO("libcoreclr dlopen and dlsym success");
+ return 0;
+}
+
+int CoreRuntime::initialize(bool standalone)
+{
+#define __XSTR(x) #x
+#define __STR(x) __XSTR(x)
+
+#ifdef NATIVE_LIB_DIR
+ __nativeLibDirectory = __STR(NATIVE_LIB_DIR);
+#endif
+
+#undef __STR
+#undef __XSTR
+
+ if (__enableLogManager) {
+ if (initializeLogManager() < 0) {
+ _ERR("Failed to initnialize LogManager");
+ return -1;
+ }
+
+ if (redirectFD() < 0) {
+ _ERR("Failed to redirect FD");
+ return -1;
+ }
+
+ if (runLoggingThread() < 0) {
+ _ERR("Failed to create and run logging thread to redicrect log");
+ return -1;
+ }
+ }
+
if (!standalone)
pluginPreload();
public:
CoreRuntime(const char* mode);
~CoreRuntime();
+ int preinitialize(bool standalone);
int initialize(bool standalone);
void dispose();
int launch(const char* appId, const char* root, const char* path, int argc, char* argv[]);
private:
AppInfo appInfo;
loader_lifecycle_callback_s callbacks;
+ hydra_lifecycle_callback_s hydraCallbacks;
loader_adapter_s adapter;
bool __isLaunched;
std::string __launchPath;
}
}
- return ECORE_CALLBACK_CANCEL;
+ return ECORE_CALLBACK_RENEW;
}
static void fdAdd(void *data, int fd, loader_receiver_cb receiver)
return 0;
};
+ // Called before initial fork
+ hydraCallbacks.precreate = [](void* userData) {
+ WITH_SELF(userData) {
+ if (self->onPreCreate != nullptr)
+ self->onPreCreate();
+ }
+ };
+
+ hydraCallbacks.create = [](void* userData) {
+ ecore_init();
+ };
+
+ // Called after fork in candidate
+ hydraCallbacks.fork = [](void *userData) {
+ ecore_fork_reset();
+ };
+
+ hydraCallbacks.terminate = [](void* userData) {
+ ecore_shutdown();
+ return 0;
+ };
+
adapter.loop_begin = [](void *data) {
ecore_main_loop_begin();
};
adapter.add_fd = fdAdd;
adapter.remove_fd = fdRemove;
- _INFO("launchpad_loader_main is start");
- int r = launchpad_loader_main(argc, argv, &(this->callbacks), &(this->adapter), this);
- _INFO("launchpad_loader_main is finished with [%d]", r);
+ _INFO("launchpad_hydra_main is start");
+ int r = launchpad_hydra_main(argc, argv, &(this->hydraCallbacks),
+ &(this->callbacks), &(this->adapter), this);
+ _INFO("launchpad_hydra_main is finished with [%d]", r);
return r;
}
{
public:
virtual int loaderMain(int argc, char* argv[]) = 0;
+ std::function<void()> onPreCreate = nullptr;
std::function<void()> onCreate = nullptr;
std::function<void(const AppInfo&, int, char**)> onLaunch = nullptr;
std::function<void(const AppInfo&, int, char**)> onTerminate = nullptr;
snprintf(appId, 16, "%s", "dotnet-launcher");
appRoot = baseName(argv[1]);
+ if (runtime->preinitialize(true) != 0) {
+ _ERR("Failed to preinitialized");
+ return 1;
+ }
+
if (runtime->initialize(true) != 0) {
_ERR("Failed to initialize");
return 1;
}
_INFO("AUL_APPID : %s", appId);
+ if (runtime->preinitialize(true) != 0) {
+ _ERR("Failed to preinitialized");
+ return 1;
+ }
+
if (runtime->initialize(true) != 0) {
_ERR("Failed to initialize");
return 1;
return 1;
}
} else {
+ Launchpad.onPreCreate = [&runtime]() {
+ if (runtime->preinitialize(false) != 0)
+ _ERR("Failed to preinitialized");
+ else
+ _INFO("Success to preinitialized");
+ };
+
Launchpad.onCreate = [&runtime]() {
if (runtime->initialize(false) != 0)
_ERR("Failed to initialized");