#define GET_PTR_OID(x) ((unsigned int *)(x + sizeof(int)))
#define GET_PTR_EOFF(x,n) ((short *)(x + sizeof(int) + (n*sizeof(unsigned int))))
#define GET_PTR_ARRYFLD(x,n) ((short *)(x + sizeof(int) + (n*sizeof(unsigned int)) + (n*sizeof(short))))
+#define ENDEBUG(s) { printf("Inside %s()\n", s); fflush(stdout);}
+#define EXDEBUG(s) {printf("Outside %s()\n", s); fflush(stdout);}
/*****************************************
* Coordinator Messages
***************************************/
#include <time.h>
#include "sockpool.h"
#include "prelookup.h"
+#include <signal.h>
//bit designations for status field of objheader
#define DIRTY 0x01
#define LOCK 0x04
#define LOCAL 0x08
+/*******Global statistics *********/
+extern int numprefetchsites;
+
#ifdef COMPILER
#include "structdefs.h"
int lookupObject(unsigned int * oid, short offset);
int transPrefetchProcess(transrecord_t *, int **, short);
void sendPrefetchReq(prefetchpile_t*, int);
+void sendPrefetchReqnew(prefetchpile_t*, int);
int getPrefetchResponse(int);
unsigned short getObjType(unsigned int oid);
int startRemoteThread(unsigned int oid, unsigned int mid);
while(headoffset<tailoffset)
;
//Wait for tail to go past new start
- while(tailoffset<tmpoffset)
+ while(tailoffset<=tmpoffset)
;
*((int *)(memory+headoffset))=-1;//safe because we left space
*((int*)memory)=size+sizeof(int);
return memory+sizeof(int);
} else {
- while(headoffset<tailoffset&&tailoffset<tmpoffset)
+ while(headoffset<tailoffset&&tailoffset<=tmpoffset)
;
- *((int*)(memory+headoffset))=size+sizeof(int);
+ *((int*)(memory+headoffset))=size+sizeof(int);
return memory+headoffset+sizeof(int);
}
}
remoteAddr.sin_port = htons(LISTEN_PORT);
remoteAddr.sin_addr.s_addr = htonl(mid);
if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) {
+ perror("socket connect: ");
printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT);
close(sd);
return -1;