This is an automated email from the ASF dual-hosted git repository. luckychen pushed a commit to branch feature/0.26.2.19-jit in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
commit 3c6ba22914c2107b67e1fa38e4169c4d543e4d82 Author: 东煜 <[email protected]> AuthorDate: Mon Aug 19 18:22:43 2019 +0800 add pid and genId to ashmem --- .../Source/android/multiprocess/weex_js_connection.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/weex_core/Source/android/multiprocess/weex_js_connection.cpp b/weex_core/Source/android/multiprocess/weex_js_connection.cpp index 11bd292..13dfb48 100644 --- a/weex_core/Source/android/multiprocess/weex_js_connection.cpp +++ b/weex_core/Source/android/multiprocess/weex_js_connection.cpp @@ -196,10 +196,16 @@ static void *newIPCServer(void *_td) { } return nullptr; } - +static int s_memId = 0; IPCSender *WeexJSConnection::start(IPCHandler *handler, IPCHandler *serverHandler, bool reinit) { - int fd = ashmem_create_region("WEEX_IPC_CLIENT", IPCFutexPageQueue::ipc_size); + pid_t pid = getpid(); + int id = __sync_fetch_and_add(&s_memId, 1); + std::string clientName("WEEX_IPC_CLIENT-"); + clientName += std::to_string(pid); + clientName += "-"; + clientName += std::to_string(id); + int fd = ashmem_create_region(clientName.c_str(), IPCFutexPageQueue::ipc_size); if (-1 == fd) { throw IPCException("failed to create ashmem region: %s", strerror(errno)); } @@ -215,11 +221,15 @@ IPCSender *WeexJSConnection::start(IPCHandler *handler, IPCHandler *serverHandle std::unique_ptr<IPCSender> sender(createIPCSender(futexPageQueue.get(), handler)); m_impl->serverSender = std::move(sender); m_impl->futexPageQueue = std::move(futexPageQueue); - - int fd2 = ashmem_create_region("WEEX_IPC_SERVER", IPCFutexPageQueue::ipc_size); + std::string serverName("WEEX_IPC_SERVER-"); + serverName += std::to_string(pid); + serverName += "-"; + serverName += std::to_string(id); + int fd2 = ashmem_create_region(serverName.c_str(), IPCFutexPageQueue::ipc_size); if (-1 == fd2) { throw IPCException("failed to create ashmem region: %s", strerror(errno)); } + LOGE("weex create Client's Name is %s Server's name is %s",clientName.c_str(), serverName.c_str()); fd_server_closed = false; ThreadData td = { static_cast<int>(fd2), static_cast<IPCHandler *>(serverHandler) };
