// Output the C class declarations
// These could mutually reference each other
+ if (state.THREAD)
+ outclassdefs.println("#include <pthread.h>");
+
outclassdefs.println("struct "+arraytype+";");
Iterator it=state.getClassSymbolTable().getDescriptorsIterator();
//Print out definition for array type
outclassdefs.println("struct "+arraytype+" {");
outclassdefs.println(" int type;");
- outclassdefs.println(" int flag;");
+ if (state.THREAD) {
+ outclassdefs.println(" pthread_t tid;");
+ outclassdefs.println(" int lockcount;");
+ }
if (state.TASK) {
+ outclassdefs.println(" int flag;");
outclassdefs.println(" void * flagptr;");
}
printClassStruct(typeutil.getClass(TypeUtil.ObjectClass), outclassdefs);
break;
}
if (state.THREAD) {
- outmethod.println("pthread_mutex_lock(&threadtable);");
- outmethod.println("threadcount--;");
- outmethod.println("pthread_mutex_unlock(&threadtable);");
outmethod.println("pthread_mutex_lock(&gclistlock);");
+ outmethod.println("threadcount--;");
outmethod.println("pthread_cond_signal(&gccond);");
outmethod.println("pthread_mutex_unlock(&gclistlock);");
outmethod.println("pthread_exit(NULL);");
/* Output class structure */
classdefout.println("struct "+cn.getSafeSymbol()+" {");
classdefout.println(" int type;");
- classdefout.println(" int flag;");
+ if (state.THREAD) {
+ classdefout.println(" pthread_t tid;");
+ classdefout.println(" int lockcount;");
+ }
if (state.TASK) {
+ classdefout.println(" int flag;");
classdefout.println(" void * flagptr;");
}
printClassStruct(cn, classdefout);