*not part of the build*
fix for 88176 git-svn-id: svn://10.0.0.236/trunk@98775 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "nsIModule.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "stdlib.h"
|
||||
#include "prthread.h"
|
||||
#include "prmon.h"
|
||||
|
||||
#define BC_JAVA_SAMPLE_CID \
|
||||
{0x072fa586, 0x1dd2, 0x11b2, \
|
||||
@@ -132,6 +134,26 @@ NS_IMETHODIMP bcJavaSample::Test9(nsIID * *po) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
static bcIJavaSample * javaSample = NULL;
|
||||
|
||||
void thread_start( void *arg ) {
|
||||
printf("--thread_start currentThread=%p\n",PR_GetCurrentThread());
|
||||
if (javaSample == NULL) {
|
||||
nsresult r;
|
||||
r = nsComponentManager::CreateInstance("bcJavaSample",
|
||||
nsnull,
|
||||
NS_GET_IID(bcIJavaSample),
|
||||
(void**)&javaSample);
|
||||
// } else {
|
||||
bcIJavaSample *t;
|
||||
javaSample->Test1((int)PR_GetCurrentThread());
|
||||
printf("--thread_start after first invocation \n");
|
||||
javaSample->Test1((int)PR_GetCurrentThread());
|
||||
printf("--thread_start after second invocation \n");
|
||||
}
|
||||
}
|
||||
|
||||
void test() {
|
||||
printf("--BlackConnect test start\n");
|
||||
nsresult r;
|
||||
@@ -148,17 +170,31 @@ void test() {
|
||||
//sigsend(P_PID, getpid(),SIGINT);
|
||||
//test->Test1(2000);
|
||||
#if 1
|
||||
{
|
||||
for (int i = 0; i < 1; i++) {
|
||||
printf("\n--we are creating threads i=%d\n",i);
|
||||
PRThread *thr = PR_CreateThread( PR_USER_THREAD,
|
||||
thread_start,
|
||||
test,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_LOCAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
0);
|
||||
PR_JoinThread(thr);
|
||||
}
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
test->Test1(1000);
|
||||
bcIJavaSample *test1;
|
||||
if (NS_FAILED(r)) {
|
||||
printf("failed to get component. try to restart test\n");
|
||||
} else {
|
||||
test->Test2(a);
|
||||
}
|
||||
}
|
||||
test->QueryInterface(NS_GET_IID(bcIJavaSample),(void**)&test1);
|
||||
int intArray[] = {1,2,3};
|
||||
test->Test3(3, intArray);
|
||||
#endif
|
||||
{
|
||||
char ** valueArray = (char **)malloc(sizeof(char*)*4);
|
||||
valueArray[0] = "hi";
|
||||
|
||||
@@ -48,9 +48,11 @@ public class bcJavaSample implements bcIJavaSample {
|
||||
}
|
||||
public void test1(int l) {
|
||||
System.out.println("--[java]bcJavaSample.test1 "+l+"\n");
|
||||
|
||||
|
||||
}
|
||||
try {
|
||||
Thread.currentThread().sleep(1000);
|
||||
} catch (java.lang.InterruptedException e) {
|
||||
};
|
||||
}
|
||||
public void test2(bcIJavaSample o) {
|
||||
System.out.println("--[java]bcJavaSample.test2");
|
||||
System.out.println("--[java]bcJavaSample.test2 :)))) Hi there");
|
||||
|
||||
Reference in New Issue
Block a user