int Configurator::SyncUserData() { HANDLE hMutex = CreateMutex(NULL, TRUE, L"WeaselDeployerMutex"); if (!hMutex) { LOG(ERROR) << "Error creating WeaselDeployerMutex."; return 1; } if (GetLastError() == ERROR_ALREADY_EXISTS) { LOG(WARNING) << "another deployer process is running; aborting operation."; CloseHandle(hMutex); MessageBox(NULL, L"正在執行另一項部署任務,請稍候再試。", L"【小狼毫】", MB_OK | MB_ICONINFORMATION); return 1; } weasel::Client client; if (client.Connect()) { LOG(INFO) << "Turning WeaselServer into maintenance mode."; client.StartMaintenance(); } { rime::Deployer& deployer(rime::Service::instance().deployer()); if (!RimeSyncUserData()) { LOG(ERROR) << "Error synching user data."; return 1; } RimeJoinMaintenanceThread(); } CloseHandle(hMutex); // should be closed before resuming service. if (client.Connect()) { LOG(INFO) << "Resuming service."; client.EndMaintenance(); } return 0; }
static void check(JNIEnv *env, jobject thiz, jboolean full_check) { RimeStartMaintenance((Bool)full_check); if (RimeIsMaintenancing()) RimeJoinMaintenanceThread(); RimeSetNotificationHandler(&on_message, NULL); }