Skip navigation.
Home
The QNX Community Portal

View topic - how can i let two process open a resource manager ?

how can i let two process open a resource manager ?

anything that doesn't fit to other groups.

how can i let two process open a resource manager ?

Postby b0207191 » Thu Aug 19, 2010 1:26 am

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
Code: Select all
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?
b0207191
New Member
 
Posts: 7
Joined: Thu May 06, 2010 9:13 am

RE: how can i let two process open a resource manager ?

Postby maschoen » Thu Aug 19, 2010 5:41 am

The resource manager code that calls your write routine locks the ocb before entering.
maschoen
QNX Master
 
Posts: 2647
Joined: Wed Jun 25, 2003 5:18 pm

Re: RE: how can i let two process open a resource manager ?

Postby b0207191 » Thu Aug 19, 2010 6:13 am

maschoen wrote: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.
b0207191
New Member
 
Posts: 7
Joined: Thu May 06, 2010 9:13 am

RE: Re: RE: how can i let two process open a resource manage

Postby maschoen » Thu Aug 19, 2010 7:56 am

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.

http://www.amazon.com/Getting-Started-N ... 497&sr=8-1
maschoen
QNX Master
 
Posts: 2647
Joined: Wed Jun 25, 2003 5:18 pm


Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest