You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/17 15:28:23 UTC
svn commit: r816182 - in /commons/sandbox/runtime/trunk/src:
main/native/include/arch/windows/ main/native/os/unix/
main/native/os/win32/ main/native/shared/ main/native/test/
test/org/apache/commons/runtime/
Author: mturk
Date: Thu Sep 17 13:28:22 2009
New Revision: 816182
URL: http://svn.apache.org/viewvc?rev=816182&view=rev
Log:
Display thread name when testing
Modified:
commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
commons/sandbox/runtime/trunk/src/main/native/shared/sigaction.c
commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestSignal.java
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=816182&r1=816181&r2=816182&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Thu Sep 17 13:28:22 2009
@@ -451,6 +451,8 @@
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
+#define ACR_NUMSIG _NSIG
+
/*
* Although defined ony for __cplusplus we use it anyhow
*/
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c?rev=816182&r1=816181&r2=816182&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/main.c Thu Sep 17 13:28:22 2009
@@ -182,7 +182,7 @@
char tn[32];
JavaVMAttachArgs aa;
- sprintf(tn, "NativeThread-%u", V2U(pthread_self()));
+ sprintf(tn, "ACR Native Thread %u", V2U(pthread_self()));
aa.version = JNI_VERSION_1_4;
aa.name = tn;
aa.group = NULL;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c?rev=816182&r1=816181&r2=816182&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Thu Sep 17 13:28:22 2009
@@ -479,7 +479,7 @@
char tn[32];
JavaVMAttachArgs aa;
- sprintf(tn, "NativeThread-%u", GetCurrentThreadId());
+ sprintf(tn, "ACR Native Thread %u", GetCurrentThreadId());
aa.version = JNI_VERSION_1_4;
aa.name = tn;
aa.group = NULL;
Modified: commons/sandbox/runtime/trunk/src/main/native/shared/sigaction.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/sigaction.c?rev=816182&r1=816181&r2=816182&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/sigaction.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/sigaction.c Thu Sep 17 13:28:22 2009
@@ -244,7 +244,7 @@
jint mode, jobject callback)
{
acr_sigfunc_t *handler;
- int signum;
+ int signum = 0;
fprintf(stdout, "Setting signal %d for %d\n", signum, getpid());
fflush(stdout);
Modified: commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c?rev=816182&r1=816181&r2=816182&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c Thu Sep 17 13:28:22 2009
@@ -545,12 +545,18 @@
ppid = atoi(argv[0]);
if (ppid == 0)
return ACR_EINVAL;
- rc = ACR_RaiseSignal(NULL, SIGINT, ppid);
- rc = ACR_RaiseSignal(NULL, SIGSTOP, ppid);
- rc = ACR_RaiseSignal(NULL, SIGSTOP, ppid);
- rc = ACR_RaiseSignal(NULL, SIGCONT, ppid);
- rc = ACR_RaiseSignal(NULL, SIGQUIT, ppid);
- rc = ACR_RaiseSignal(NULL, SIGBUS, ppid);
+ if (argc > 1) {
+ int signo = atoi(argv[1]);
+ rc = ACR_RaiseSignal(NULL, signo, ppid);
+ }
+ else {
+ rc = ACR_RaiseSignal(NULL, SIGINT, ppid);
+ rc = ACR_RaiseSignal(NULL, SIGSTOP, ppid);
+ rc = ACR_RaiseSignal(NULL, SIGSTOP, ppid);
+ rc = ACR_RaiseSignal(NULL, SIGCONT, ppid);
+ rc = ACR_RaiseSignal(NULL, SIGQUIT, ppid);
+ rc = ACR_RaiseSignal(NULL, SIGBUS, ppid);
+ }
if (rc) {
char buf[256];
fprintf(stderr, ACR_GetErrorString(rc, buf, sizeof(buf)));
Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestSignal.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestSignal.java?rev=816182&r1=816181&r2=816182&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestSignal.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestSignal.java Thu Sep 17 13:28:22 2009
@@ -47,6 +47,7 @@
{
System.out.println();
System.out.println("Received signal(" + signo + ") continuing...");
+ System.out.println("Signal executed in " + Thread.currentThread().getName() + " tread.");
}
}
@@ -55,7 +56,7 @@
{
Handler h = new Handler();
SignalAction.handler(Signal.SIGINT, h);
- System.out.println("Handler initialized...");
+ System.out.println("Handler initialized in " + Thread.currentThread().getName() + " tread.");
for (int i = 0; i < 10; i++) {
try {
Thread.sleep(1000);