Skip to content

Instantly share code, notes, and snippets.

@xiaoqiangwang
Created March 9, 2017 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiaoqiangwang/16576c1739e60300dde407bae044b88e to your computer and use it in GitHub Desktop.
Save xiaoqiangwang/16576c1739e60300dde407bae044b88e to your computer and use it in GitHub Desktop.
test of ca sync group
#include "cadef.h"
int main(int argc, char **argv)
{
CA_SYNC_GID gid;
chanId chid;
double value;
int status;
// preemptive disabled, no hang up
// status = ca_context_create(ca_disable_preemptive_callback);
// preemptive enabled, hang up
status = ca_context_create(ca_enable_preemptive_callback);
SEVCHK(status, "create context");
status = ca_create_channel("catest", NULL, NULL, 0, &chid);
status = ca_pend_io(2);
SEVCHK(status, "create channel");
status = ca_sg_create(&gid);
SEVCHK(status, "create sync group");
status = ca_sg_array_get(gid, DBR_DOUBLE, 1, chid, &value);
SEVCHK(status, "sync group get");
while (ca_sg_test(gid) != ECA_IODONE)
ca_sg_block(gid, 0.01);
}
record(ao,"catest")
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment