mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Add convenient method to raise a custom signal
Contributed by STMicroelectronics Change-Id: Ie9c6c7d87e1efc8e13861c3551c11a1da0be2695 Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
This commit is contained in:
parent
e4c46094b1
commit
b3be425429
11 changed files with 16 additions and 39 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: org.eclipse.cdt.core.native;singleton:=true
|
||||
Bundle-Version: 6.1.400.qualifier
|
||||
Bundle-Version: 6.2.0.qualifier
|
||||
Bundle-Activator: org.eclipse.cdt.internal.core.natives.CNativePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
|
|
@ -225,43 +225,9 @@ bail_out:
|
|||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv *env, jobject jobj, jint pid, jint sig) {
|
||||
int status = -1;
|
||||
|
||||
switch (sig) {
|
||||
case org_eclipse_cdt_utils_spawner_Spawner_SIG_NOOP:
|
||||
status = killpg(pid, 0);
|
||||
if (status == -1) {
|
||||
status = kill(pid, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case org_eclipse_cdt_utils_spawner_Spawner_SIG_INT:
|
||||
status = killpg(pid, SIGINT);
|
||||
if (status == -1) {
|
||||
status = kill(pid, SIGINT);
|
||||
}
|
||||
break;
|
||||
|
||||
case org_eclipse_cdt_utils_spawner_Spawner_SIG_KILL:
|
||||
status = killpg(pid, SIGKILL);
|
||||
if (status == -1) {
|
||||
status = kill(pid, SIGKILL);
|
||||
}
|
||||
break;
|
||||
|
||||
case org_eclipse_cdt_utils_spawner_Spawner_SIG_TERM:
|
||||
status = killpg(pid, SIGTERM);
|
||||
if (status == -1) {
|
||||
status = kill(pid, SIGTERM);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = killpg(pid, sig);
|
||||
if (status == -1) {
|
||||
status = kill(pid, sig);
|
||||
}
|
||||
break;
|
||||
int status = killpg(pid, sig);
|
||||
if (status == -1) {
|
||||
status = kill(pid, sig);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
|
|
@ -666,6 +666,10 @@ extern "C"
|
|||
ret = (WaitForSingleObject(pCurProcInfo->eventWait.handle, 100) == WAIT_OBJECT_0);
|
||||
break;
|
||||
default:
|
||||
if (isTraceEnabled(CDT_TRACE_SPAWNER)) {
|
||||
cdtTrace(L"Spawner does not support custom signals on Windows\n");
|
||||
}
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<version>6.1.400-SNAPSHOT</version>
|
||||
<version>6.2.0-SNAPSHOT</version>
|
||||
<artifactId>org.eclipse.cdt.core.native</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
|
|
|
@ -497,6 +497,13 @@ public class Spawner extends Process {
|
|||
*/
|
||||
public native int raise(int processID, int sig);
|
||||
|
||||
/**
|
||||
* @since 6.2
|
||||
*/
|
||||
public int raise(int sig) {
|
||||
return raise(pid, sig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to wait(3) for process to terminate.
|
||||
* @noreference This method is not intended to be referenced by clients.
|
||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue