Opened 12 years ago
Closed 12 years ago
#89 closed defect (wontfix)
Asynchronous stream API is not asynchronous
Reported by: | Matthias Vogelgesang | Owned by: | Suren A. Chilingaryan |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | pcilib | Version: | |
Keywords: | Cc: | Suren A. Chilingaryan |
Description
Calls to pcilib_stream
block and do not allow an asynchronous operation without introducing a new (user level) thread. As I have to provide a callback method to pcilib_stream
, I would assume the call itself is asynchronous and return.
AFAIR, this behaviour is a regression and worked in an earlier version of pcilib.
Attachments (0)
Change History (3)
comment:1 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Then why do I have to provide a callback? This makes absolutely no sense in our layered architecture if you block anyway. Just to cite Wikipedia (with deferred they mean asynchronous):
Deferred callbacks are often used in the context of I/O operations or event handling.
This is the case here. So my suggestion: either don't provide a function that takes a callback or make it asynchronous.
comment:3 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
I think I have explained why I prefer not to start threads. I'm using this function in pci tool. In my opinion it is more convenient compared to get_next_event approach. So, I'll not remove it. But you are not enforced to use this function if you don't like.
It is just stream API, not the asynchronous stream API. I.e. it is expected behaviour. I don't like to start threads in the libraries unless there is no ways around. If you want it asynchronous it is only a few operators to start a thread. But you will have a complete control on this thread: priority, affinity, thread pooling. If I'd start thread in the library, you will not able to affect this parameters or I'd need to provide complex interfaces to control them.
Besides, for speed reasons we will use rawdata callback anyway (see ticket #90), which is asynchronous by the way (In this case I don't see a good solution to avoid it at the moment). So, it doesn't really matter.