}
//Logs filename as per client requests
- public void logrequest(String filename){
+ public synchronized void logrequest(String filename){
String request = new String("\nNew Request received: ");
fos.write(request.getBytes());
fos.write(filename.getBytes());
fos.flush();
}
- public void logrequest(){
+ public synchronized void logrequest(){
String request = new String("\nNew Request received: ");
fos.write(request.getBytes());
fos.flush();
#include <stdlib.h>
#include "thread.h"
#include "option.h"
+#include <signal.h>
#include <stdio.h>
int threadcount;
void CALL01(___Thread______nativeCreate____, struct ___Thread___ * ___this___) {
pthread_t thread;
+ int retval;
+ pthread_attr_t nattr;
+
pthread_mutex_lock(&gclistlock);
threadcount++;
pthread_mutex_unlock(&gclistlock);
- pthread_create(&thread, NULL,(void * (*)(void *)) &initthread, VAR(___this___));
+ pthread_attr_init(&nattr);
+ pthread_attr_setdetachstate(&nattr, PTHREAD_CREATE_DETACHED);
+
+ do {
+ retval=pthread_create(&thread, &nattr, (void * (*)(void *)) &initthread, VAR(___this___));
+ if (retval!=0)
+ usleep(1);
+ } while(retval!=0);
+
+ pthread_attr_destroy(&nattr);
}
#ifndef THREAD_H
#define THREAD_H
#include "methodheaders.h"
-#include "pthread.h"
+#include <pthread.h>
extern int threadcount;
extern pthread_mutex_t gclock;
elif [[ $1 = '-thread' ]]
then
JAVAOPTS="$JAVAOPTS -thread"
-EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS"
+EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
elif [[ $1 = '-curdir' ]]
then
CURDIR=$2