Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put callback fails if async writing completes immediately #9

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

Reported by Kay Kasemir:

I think I found the problem in driver.py:

   def writeNotify(self, context, value):
            success = self.writeValue(value)
            # do asynchronous only if PV supports
            if success and self.info.asyn:
                # async write will finish later
                self.startAsyncWrite(context)


In response to a "caput -c …", it will
1) Call writeValue(), i.e. eventually my write implementation
2) startAsyncWrite()

If my write operation takes a long time before invoking callbackPV(), all is 
fine.
But our write operations don't always take a long time. They may in fact be 
very fast, but we need the put-callback for instrument control to assert that 
the operation really finished.
So if my write finished quickly, it will in step one already call callbackPV() 
before the startAsyncWrite() in step 2 created it.

Needs to be somewhat like this:

   def writeNotify(self, context, value):
            if self.info.asyn:
                   self.startAsyncWrite(context)
                      success = self.writeValue(value)
                      …

Original issue reported on code.google.com by xiaoqian...@gmail.com on 16 Sep 2014 at 12:21

@GoogleCodeExporter
Copy link
Author

This has been fixed in commit 
https://code.google.com/p/pcaspy/source/detail?r=1b6280cbbd79dcdaf4142af037aa260
d3017cef6

Original comment by xiaoqian...@gmail.com on 19 Sep 2014 at 12:59

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant