102
K
A
DAK
AMX Semaphore Manager
#include "amx831cf.h" /* AMX C Interface Header */
static AMXID ncaccess; /* Coprocessor resource */
/* semaphore id */
void cdecl rruser(void)
{ajsmcre(&ncaccess, -1, "387P"); /* Create resource semaphore */
}
int ncmath(
AMXID ncid) /* Semaphore id */
{int status;
status = ajsmrsv(ncid, 0, 20); /* Reserve coprocessor */
if (status == AEROK) {
:
use coprocessor and do math operation
:
status = ajsmrls(ncid); /* Release coprocessor */
}
return(status);
}
void cdecl sttaskA(void)
{ajsmrsv(ncaccess, 0, 20); /* Reserve coprocessor */
:
initialize coprocessor
:
ncmath(ncaccess); /* Common math operation */
ajsmrls(ncaccess); /* Release coprocessor */
:
}
void cdecl sttaskB(void)
{:
ncmath(ncaccess); /* Common math operation */
;
}