Click here to Skip to main content
13,189,802 members (61,697 online)
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 8 Aug 2002

CObjBroker - Limited Resource Broker class

, 8 Aug 2002
Rate this:
Please Sign up or sign in to vote.
If you are working with limited resources in a multithreaded scenario, ObjBroker will help you...

Sample Image - demo.gif


Sometimes we have multithreaded scenarios and always the problem is in concurrently accessing the same resource in two threads or more. So, common solution is each resource has a lock synchronization object. But it's not good if resources to be managed are many. How about safe resource manager from threads?

Object Broker

CObjBroker is manager class to distribute limited resources to threads. Surely CObjBro have to be thread-safe. (and I hope it is) See below:

About Demo

In demo, there are two resources called 'bro1' and 'bro2' who is poor programmer ( it's me.. ) and a third thread called 'project manager' who wants to get 'bro'. 'pm1' and 'pm2 get 'bro', and keep 'bro' working until 'bro' is tired. If 'bro' is tired then release 'bro'. Last, 3rd 'pm' is good 'pm'. He gets 'bro', then he lets 'bro' rest. If 'bro' is afresh, then release for other worker 'pm's.

CBroBroker is driven from CObjBroker. And he manages 'bro's with std::list. Demo code is easy to read, so you can get an idea from CObjBroker.

I hope it helps you too. And I want your good advice and suggestion!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Cho, Kyung-min
Software Developer
Korea (Republic of) Korea (Republic of)
No Biography provided

You may also be interested in...

Comments and Discussions

Generalexcellent job! Pin
matrixnull22-Jan-10 17:10
membermatrixnull22-Jan-10 17:10 
excellent job!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171016.2 | Last Updated 9 Aug 2002
Article Copyright 2002 by Cho, Kyung-min
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid