David Brownell wrote: >>> Wouldn't a plain old atomic "BUSY" bitflag work better? If it's >>> set, usbcore would reject urbs with -EAGAIN ... from all >>> contexts, including the many that can't acquire semaphores! >> >> >> I thought (and I might be confused with other OSes here) that there >> was a way to attempt to acquire a semaphore from an 'unfriendly' >> context -- either you got the semaphore or you got an indication >> that you can't get it. > > As in down_trylock()? Thing is, one can't necessarily know > whether the current context is "friendly" or not. So one API > design strategy thus starts out assuming none of them are, and > then sees how well that applies system-wide. Hence a bit flag. >
But wouldn't a bit flag require continuous retries on the part of whomever gets the -EAGAIN when they try to submit an URB? And, if so, wouldn't that leave open the possibility of them missing the window when the BUSY bit isn't set (unless they retry in a very tight loop, in which case they could waste a lot of processor time)? > >> The problem is in figuring out which devices need this treatment. >> Since the only way to discover this is by crashing the device, it's >> not very friendly. > > But at that point you'll know, and can add it to the list. It's also > not friendly to re-define USB so that it won't work well with devices > that don't have this rare bug ... :) > > - Dave I don't understand why this would make USB not work well with devices that don't have this problem. I would think grabbing a semaphore would be extremely quick unless someone else already has it, which should be a very rare occurrance. ------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel