Thomas Haupt
|
Re: Resource Manager with Multiple Clients
|
Thomas Haupt
08/20/2010 3:39 AM
post63679
|
Re: Resource Manager with Multiple Clients
Hi,
in general, your approach looks quite good. Within the resmgr framework, you'll need to pay attention to a few points,
though.
First, while it's theoretically ok to queue the incoming data for all (read) clients, you should be aware that this way,
a client that did an open() but never performs a read() could easily crash at least your driver with a memory overflow.
Usually one would prefer having a fixed-size buffer within the driver and run the risk that the client misses some data
if it doesn't keep up reading.
Also, what you shouldn't do is MsgSend() to a client from a resource manager - it is supposed to receive and reply
only. Best extend your ocb so that you can maintain a list of read-blocked clients. In your io_read handler, if no data
is available, insert the ocb into that list and do not reply. When new data arrives, walk that list and reply the new
data to all the blocked clients.
For the select-handling, use iofunc_notify() to insert select()ing clients into a list of blocked clients, and upon data
arrival do
iofunc_notify_trigger( nop, 1, IOFUNC_NOTIFY_INPUT )
Hope this helps,
- Thomas
|
|
|