Resource Manager Question

I am writing a resource manager to communicate with a USB device.
I have two communication pipes, one for HOST to DEVICE communication and nother for DEVICE to HOST.

This resource manager has two clients {threads}, one utilizes this device as write only and other as read only. My idea here is “read only” thread should be blocked until it really got data through USB device. “Write only” should have access to write data at any time. If “read only” thread is blocked for data, “write only” thread will not be given chance to run?

Do I need to create this resource manager with multiple threads?

Thanks in advance.


First I guess a couple of questions. Are you aware there is a usb ddk for talking to usb devices and is this what you are using?

Second, although you are using the term resource manager, this has a particular meaning in QNX and I am not sure that is how you are using it. There is quite a section in the help viewer on resource managers. Generally the clients they service are the applications which use their resources, not the hardware they are talking to.

There is nothing wrong with your ideas, the description doesn’t necessarily fit into our expectations. Perhaps if you describe what device you are trying to talk to and someone can give you ideason what the best approach is (in QNX) to write the driver/resource manager. :slight_smile:

I guess I’ve the same problem as krishb. Perhaps I can specify it: I’ve writen a recouce manager like the one in ‘writing a resource manager - mulithreaded RM’ from qnx. I also added devctl() operations and my Interrupt handler works in his own thread. My RM is for communication directly with a Controller (sja1000 for CAN).
Wenn a read- operation is given to the RM (like cat /dev/can or by devctl()) and there’s no message available, the reading thread waits by a semaphore. This semaphore is post by the interrupt handler. Evry writing to the path isn’t possible now.
Wenn I look to the pidin I see 5 threads: one is waiting on SEM (this shoud be the reading thread), on waits for INTR (the interrupt handler), one for CONDVAR (i guess the writing thread) and 2 others are in RECEIVE-status. Why does the writing thread waits for a condition variable, although i didn’t declaired any?? Is there a possibility to let a thread write to the device while a other thead is waiting for a semaphore?

I hope, i didn’t interfered to mutch, but I guess it’s the same problem like krishb’s.

thanks in advance,

When your callbacks are invoked the attr for the device is locked. If you are going to block on another syncronization object and you want to allow other I/O operations to occur, you have to unlock it.


That is the call you need to make. When you are signaled by the interrupt thread you will have to re-lock the attribute.

thx a lot for the quick and successful answer!!!