Cleaned up ANSTO code to merge with sinqdev.sics
This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c Conflicts: .gitignore SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c event.h exebuf.c exeman.c histmem.c interface.h motor.c motorlist.c motorsec.c multicounter.c napi.c napi.h napi4.c network.c nwatch.c nxscript.c nxxml.c nxxml.h ofac.c reflist.c scan.c sicshipadaba.c sicsobj.c site_ansto/docs/Copyright.txt site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl statusfile.c tasdrive.c tasub.c tasub.h tasublib.c tasublib.h
This commit is contained in:
24
syncedprot.c
24
syncedprot.c
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* This is a scriptcontext driver 'connecting' to its own sics server.
|
||||
* The argument of the send command is a sync id.
|
||||
* The next script of the scriptchain is called when all actions realted to
|
||||
* The next script of the scriptchain is called when all actions related to
|
||||
* this sync id are finished or on timeout.
|
||||
*
|
||||
* In addition the functions needed to implement other mechanisms than scriptcontext to
|
||||
@@ -163,10 +163,10 @@ long SyncedBegin(long syncid)
|
||||
return SYNCED_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
sp++;
|
||||
if (sp >= NSTACK) {
|
||||
return SYNCED_STACK_OVERFLOW;
|
||||
}
|
||||
sp++;
|
||||
sync->count++;
|
||||
actualSync = sync;
|
||||
return sync->id;
|
||||
@@ -181,13 +181,13 @@ long SyncedEnd(long syncid)
|
||||
if (sp <= 0) {
|
||||
return SYNCED_STACK_UNDERFLOW;
|
||||
}
|
||||
sync = actualSync;
|
||||
sp--;
|
||||
sync = actualSync;
|
||||
actualSync = stack[sp];
|
||||
sync->count--;
|
||||
if (sync->count < 0) {
|
||||
if (sync->count <= 0) {
|
||||
return SYNCED_COUNT_UNDERFLOW;
|
||||
}
|
||||
sync->count--;
|
||||
if (syncid != 0 && syncid != sync->id) {
|
||||
return SYNCED_ID_MISMATCH;
|
||||
}
|
||||
@@ -385,13 +385,15 @@ static void SyncedKillPrivate(void *private) {
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int SyncedProtInit(Ascon * a, SConnection * con, int argc, char *argv[])
|
||||
{
|
||||
if (argc == 2) {
|
||||
a->timeout = atof(argv[1]);
|
||||
} else if (argc > 2) {
|
||||
/* a dummy hostport is used */
|
||||
a->timeout = atof(argv[2]);
|
||||
a->timeout = 0.0;
|
||||
if (argc > 1) {
|
||||
/* a dummy hostport is used, here a unique name should be given */
|
||||
a->hostport = strdup(argv[1]);
|
||||
if (argc > 2) {
|
||||
a->timeout = atof(argv[2]);
|
||||
}
|
||||
} else {
|
||||
a->timeout = 0.0;
|
||||
a->hostport = strdup("synced"); /* WARNING: this name is not unique, but used by Marks new Task manager */
|
||||
}
|
||||
a->private = calloc(1, sizeof(long));
|
||||
a->killPrivate = SyncedKillPrivate;
|
||||
|
||||
Reference in New Issue
Block a user