-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
KeyboardInterrupt appears blocked by waitForSlotEvent() #117
Comments
The I don't know if it is possible to allow Ctrl-C from inside a C function called by Python. |
I believe the signal library would be able to hook the interrupt, from there you would need to break the I haven't checked the low level C code yet, but could have a look :) |
The only way to interrupt a The problem is that the application that uses PyKCS11 may also want to get |
My C is very rusty, but instinctively I think builtin Python could handle this: The end users code: import time
# `b.py` will emulate PyKCS11 here
# just for the sake of testing signal() handling
# import PyKCS11
import b
while True:
time.sleep(0.25)
import signal
_op_sigint = signal.getsignal(signal.SIGINT)
def signal_handler(sig, frame):
print("lib.C_Finalize() here")
_op_sigint(sig, frame)
signal.signal(signal.SIGINT, signal_handler) The drawback is that the stacktrace will add upon the users actual position of the Ctrl-C:
Where it was actually called on Not sure how you would access the given |
I don't think it is a good example code. In your output I do not see the We need something that is not interruptible in Python. |
Your system information
Please describe your issue in as much detail as possible:
Using the events.py example, as referenced in #167, it appears to be working but blocking KeyboardInterrupt:
The above exception, appears to be blocked until
systemctl stop pcscd.service
is executed.Steps for reproducing this issue:
Pressing Ctrl-C will result in:
Until
pcscd.service
is restarted, then:The text was updated successfully, but these errors were encountered: