Re: [PATCH] ft245r: add sem_wait with timeout on POSIX
Am 26.01.2015 um 16:38 schrieb Andrey Skvortsov:
> sometimes, if not enough bytes are received from ftdi device, avrdude
> hangs in ft245r_recv, to avoid this sem_wait is replaced with
> sem_timedwait. I tested this patch on linux.
I guess for MacOS we should implement an own function.
Probably something like this (I do not own a Mac so I cannot check if
this really correct.)
int sem_wait_with_timeout(sem_t * psem, long to_ns)
dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, to_ns);
long result = dispatch_semaphore_wait(*psem, timeout);
if (result != 0)
errno = ETIMEDOUT;