how can i let two process open a resource manager ?

i create a resource manager with thread pool.

but i found a problem with this resource manager X

when processA open X, and excute i/o operation, such as my_write(…)

when processA is blocked by my_write(), processB can’t open X until my_write(…) returns.

so i rewrite my_write() as following

my_read/my_write...(...) { iofunc_attr_unlock(ocb->attr); <--new added .... do_a_cost_much_time_task(); .... iofunc_attr_lock(ocb->attr); <--new added }

now processB can open X when processA is blocked.

why it can works? where ocb->attr is locked?

second question: i tried to use sopen() to let two process to share X, but it seems do not work, processB still blocked. why?

The resource manager code that calls your write routine locks the ocb before entering.

thank, … but where can i find the resource manager code that calls write routine? in “trunk/lib/c/iofunc”?

i am lookinf for the loop part of a resource manager.

If you want to look at it, you would have to download the resource manager source code.

I’ve spent 8+ years happily writing resource managers without ever looking at this code.

How to write a resource manager is one of the best documented parts of QNX. There’s even a third party book by Robert Krten that goes over it in depth.

amazon.com/Getting-Started-N … 497&sr=8-1