Sample Usage, PtSpawn with callback?

Can someone post a short sample Photon PtSpawn() call and the
code for the callback called when the spawned child completes?

Thanks!

Jeff

On Tue, 02 Aug 2005 15:36:18 +0200, Jeff Maass <jmaass@columbus.rr.com>
wrote:

Can someone post a short sample Photon PtSpawn() call and the
code for the callback called when the spawned child completes?

This is what I have used in a past project:

const char* argv[]={" ", NULL};

result = PtSpawn( “/ssc/my-script”,
&argv,
NULL,
NULL,
archive_complete,
NULL,
NULL );
if (result ==-1) {
result = errno;
perror("PtSpawn: ");
sprintf(msg, “%s”, strerror(result));
PtSetResource(ABW_log_msg, Pt_ARG_TEXT_STRING, msg, 0);
PtFlush();
}
else {
PtSetResource(ABW_log_msg, Pt_ARG_TEXT_STRING, “Archiving
started”, 0);
PtFlush();
}
return Pt_CONTINUE;


void archive_complete (void* data, int status) {
char msg[100];

if (status == 0) {
sprintf(msg, “Archiving complete”);
}
else {
sprintf(msg, “Archiving complete with error %x”, status);
}
PtSetResource(ABW_log_msg, Pt_ARG_TEXT_STRING, msg, 0);
}