Python ctypes.set_errno() Examples
The following are 15
code examples of ctypes.set_errno().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ctypes
, or try the search function
.
Example #1
Source File: backend_ctypes.py From bioforum with MIT License | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #2
Source File: backend_ctypes.py From oss-ftp with MIT License | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #3
Source File: backend_ctypes.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #4
Source File: backend_ctypes.py From SwiftKitten with MIT License | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #5
Source File: backend_ctypes.py From teleport with Apache License 2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #6
Source File: backend_ctypes.py From teleport with Apache License 2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #7
Source File: backend_ctypes.py From learn_python3_spider with MIT License | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #8
Source File: backend_ctypes.py From learn_python3_spider with MIT License | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #9
Source File: backend_ctypes.py From scalyr-agent-2 with Apache License 2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #10
Source File: backend_ctypes.py From quickstart-git2s3 with Apache License 2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #11
Source File: backend_ctypes.py From quickstart-git2s3 with Apache License 2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #12
Source File: backend_ctypes.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #13
Source File: backend_ctypes.py From quickstart-redhat-openshift with Apache License 2.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #14
Source File: backend_ctypes.py From odoo12-x64 with GNU General Public License v3.0 | 5 votes |
def set_errno(self, value): ctypes.set_errno(value)
Example #15
Source File: semlock.py From loky with BSD 3-Clause "New" or "Revised" License | 4 votes |
def _sem_timedwait(handle, timeout): t_start = time.time() if sys.platform != "darwin": sec = int(timeout) tv_sec = int(t_start) nsec = int(1e9 * (timeout - sec) + .5) tv_nsec = int(1e9 * (t_start - tv_sec) + .5) deadline = timespec(sec+tv_sec, nsec+tv_nsec) deadline.tv_sec += int(deadline.tv_nsec / 1000000000) deadline.tv_nsec %= 1000000000 return pthread.sem_timedwait(handle, ctypes.pointer(deadline)) # PERFORMANCE WARNING # No sem_timedwait on OSX so we implement our own method. This method can # degrade performances has the wait can have a latency up to 20 msecs deadline = t_start + timeout delay = 0 now = time.time() while True: # Poll the sem file res = pthread.sem_trywait(handle) if res == 0: return 0 else: e = ctypes.get_errno() if e != errno.EAGAIN: raiseFromErrno() # check for timeout now = time.time() if now > deadline: ctypes.set_errno(errno.ETIMEDOUT) return -1 # calculate how much time left and check the delay is not too long # -- maximum is 20 msecs difference = (deadline - now) delay = min(delay, 20e-3, difference) # Sleep and increase delay time.sleep(delay) delay += 1e-3