I've been working with libusbx for some time now --I'm primarily very happy with it-- but one design trait gave me trouble: Being forced to use C-callbacks for dealing with asynchronous transfers. It would be *really* nice if there was a "push style" API one could resort to, like this: /* inside the main-loop: */ libusb_check_events_timeout_completed(ctx, timeout, &evt_cnt); for(int i = 0; i < evt_cnt; ++i) { libusb_transfer *transfer; libusb_handle_next_transfer(ctx, &transfer); /* do something with the transfer */ }
The reason I want this is that I'm programming in LuaJIT [1], and C-callbacks are undesirable for a variety of reasons [2]. It would be *very* helpful if something like the snippet above worked in a future version of libusbx. What is your opinion on this proposal? TL/DR: make asynchronous transfers possible without using C-callbacks. Please? --Wolfgang [1] LuaJIT (http://luajit.org/) is a fast interpreter + JIT compiler for the Lua language. The fact that it offers simple access to C data-primitives (almost everything, from 64 bit uints to nested structs/unions; declarations can be copypasted verbatim from C), combined with its ability to call C functions by pasting their signature and pointing toward the relevant dll/so makes it a very appealing alternative to (or an abstraction/convenience layer on top of) C- especially for rapid prototyping. Performance is pretty competitive, e.g. calling ZMQ send_msg/recv_msg functions: LuaJIT 6160911 [msg/s], C++ 6241452 [msg/s] (difference < 2%). [2] For one, C-callbacks screw with both garbage collection (of the callback function itself) and prevent JIT compilation of the caller. PS: libusbx (and Zadig, and the related documentation) was extremely useful for me- I'd like to thank you people for the effort. PPS: I'm not opposed to MIT'ing my (currently hacky and incomplete) LuaJIT-binding after bringing it to shape, especially if anyone is interested. ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel