diff options
author | daniel <danieruru@gmail.com> | 2013-01-10 21:59:32 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-10 21:59:32 +0900 |
commit | 2e613ee1aedd07023c6c9d17795a67c68cc6ae8a (patch) | |
tree | ac0c72068ef9d4698da08c1b5c1493a96900efa5 | |
parent | d1ed69e2ed972b9ffff2ceccd151a7b7c832b3b8 (diff) |
add all of the locking calls to the calls that can be locked out
-rw-r--r-- | vxi11_server.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index b1f7c41..1d66688 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -84,7 +84,7 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { result.error = ERR_OUTOFRESOURCES; } else { - if (argp->lockDevice && isLocked()) { + if (argp->lockDevice && isLocked() && !waitForLock(argp->lock_timeout)) { result.error = ERR_DEVICELOCKEDBYANOTHERLINK; } else { @@ -125,7 +125,7 @@ device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) { if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; else { - if (isLocked(argp->lid) && !haveLock(argp->lid)) + if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { printf("%s\n", argp->data.data_val); @@ -145,15 +145,13 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { - if (isLocked(argp->lid) && !haveLock(argp->lid)) - result.error = ERR_DEVICELOCKEDBYANOTHERLINK; - else { - result.data.data_val = "HELLO!"; - result.data.data_len = 7; - result.error = 0; - result.reason = 0x4; - } + result.data.data_val = "HELLO!"; + result.data.data_len = 7; + result.error = 0; + result.reason = 0x4; } return &result; } @@ -166,6 +164,8 @@ device_readstb_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { result.error = 0; result.stb = 0; @@ -181,6 +181,8 @@ device_trigger_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { result.error = 0; } @@ -195,6 +197,8 @@ device_clear_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { result.error = 0; } @@ -209,6 +213,8 @@ device_remote_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { if (isLocked() && !haveLock(argp->lid)) result.error = ERR_DEVICELOCKEDBYANOTHERLINK; @@ -226,6 +232,8 @@ device_local_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { if (isLocked() && !haveLock(argp->lid)) result.error = ERR_DEVICELOCKEDBYANOTHERLINK; @@ -299,6 +307,8 @@ device_docmd_1_svc(Device_DocmdParms *argp, struct svc_req *rqstp) { #endif if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; + else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->lock_timeout)) + result.error = ERR_DEVICELOCKEDBYANOTHERLINK; else { result.data_out.data_out_len = 0; result.data_out.data_out_val = NULL; |