int main()
{
	int pid;
	int i=0;
	char buff[128];
	while(1)
	{
		pid = fork();
		if(pid <0)
			WriteLog("fork error \n");
		else if(0 == pid)
		{
			DoKill();
			exit(1);
		}
		else
		{
			wait(NULL);
			kill(pid,SIGKILL);
			i++;
			sprintf(buff,"kill plugin process exited No.%d \n",i);
			WriteLog(buff);
		}
	}
//long killed = 0;	
}
Exemple #2
0
// Handling of user interface and other events
void MainWindow::MessageReceived(BMessage *message)
{
	switch(message->what){
		case SELECTION_CHANGED:
			BRow *row;
			row = teamView->RowAt(message->FindInt32("index"));

			if(row != NULL && message->FindInt32("buttons") == B_SECONDARY_MOUSE_BUTTON){
				BPoint point;
				uint32 state;
				teamView->GetMouse(&point,&state);

				BPoint p2 = teamView->ConvertToScreen(point);
				p2.x -= 5.0;
				p2.y -= 5.0;
				//if(fItemMenu->FindMarked())
				//	fItemMenu->FindMarked()->SetMarked(false);

				teamView->SelectionMessage()->ReplaceInt32("buttons",0);
				teamView->ActionMenu()->Go(p2, true, true, true);
				//fItemMenu->Go(p2, true, true, true);
			}
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_KILL:
		case IE_MAINWINDOW_MAINKILL:
			DoKill();
		 	UpdateTeams();
		 	SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_SUSPEND:
		case IE_MAINWINDOW_MAINSUSPEND:
			DoSuspend();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_RESUME:
		case IE_MAINWINDOW_MAINRESUME:
			DoResume();
			UpdateTeams();
			SetButtonState();
			break;
		case SET_PRIORITY: {
			int32 priority = message->FindInt32("priority");
			DoPriority(priority);
			UpdateTeams();
			SetButtonState();
			break;
		}
		case IE_MAINWINDOW_MAINPRIORITYVALUE:
			// takes priority from text field
			DoPriority();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINUPDATE:
			UpdateTeams();
			SetButtonState();
			break;
		case B_ABOUT_REQUESTED:    // "About…" is selected from menu…
		{
			BAboutWindow* fAboutWin = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Slayer"), slayer_signature);
			fAboutWin->AddDescription(B_TRANSLATE("A thread manager for Haiku"));
			fAboutWin->SetVersion(SLAYER_VERSION);
			fAboutWin->AddCopyright(1999, "Arto Jalkanen");
			const char* authors[] = {
				"Arto Jalkanen ([email protected])",
				NULL
			};
			fAboutWin->AddAuthors(authors);
			fAboutWin->Show();
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_DOCS__:
		{
			BMessage message(B_REFS_RECEIVED);
			message.AddString("url", ProjectWebsite);
			be_roster->Launch("text/html", &message);
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_QUIT:    // "Quit" is selected from menu…
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		case IE_MAINWINDOW_MAINMENU_WINDOWS_SETTINGS:
		{
			const char* windowSettingsTitle = B_TRANSLATE("Settings");
			BWindow *settings = slayer->FindWindow(windowSettingsTitle);
			if (!settings)
				new SettingsWindow(windowSettingsTitle);
			else if (settings->Lock()) {
				settings->Activate(true);
				settings->Unlock();
			}
		}
			break;
		default:
			BWindow::MessageReceived(message);
			break;
	}

}