bugs
authorbdemsky <bdemsky>
Wed, 7 Mar 2007 03:07:47 +0000 (03:07 +0000)
committerbdemsky <bdemsky>
Wed, 7 Mar 2007 03:07:47 +0000 (03:07 +0000)
Robust/src/Benchmarks/WebServerJava/Logger.java
Robust/src/Runtime/thread.c
Robust/src/Runtime/thread.h
Robust/src/buildscript

index a23cc4fac6b8ec5310d13a2069b70fc5e56d9112..be29b3d3998778017135899581afc1e4fe32e538 100644 (file)
@@ -10,14 +10,14 @@ public class Logger {
     }
 
     //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();
index 54ea0b557728bf82a798f1aae9c82900416e3d91..7c22e069e9cef3268b1bb92874764756f52bafbd 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include "thread.h"
 #include "option.h"
+#include <signal.h>
 
 #include <stdio.h>
 int threadcount;
@@ -79,8 +80,20 @@ void initthread(struct ___Thread___ * ___this___) {
 
 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);
 }
index 0062c6bcc120d7962c81b1bab305c06dd1710dbd..5bb5d19c83e4c66ea31c7c442a34bb9d5d15cc09 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef THREAD_H
 #define THREAD_H
 #include "methodheaders.h"
-#include "pthread.h"
+#include <pthread.h>
 
 extern int threadcount;
 extern pthread_mutex_t gclock;
index 689a32b9cba0e8c7d45329abd7098d03b01a3bed..cb7a0f115174d1ba4672ea2757b83e088224659e 100755 (executable)
@@ -84,7 +84,7 @@ EXTRAOPTIONS="$EXTRAOPTIONS -O9"
 elif [[ $1 = '-thread' ]]
 then
 JAVAOPTS="$JAVAOPTS -thread"
-EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS"
+EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
 elif [[ $1 = '-curdir' ]]
 then
 CURDIR=$2