LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-01-2007, 11:41 AM   #1
nalsrayatko
LQ Newbie
 
Registered: Nov 2007
Distribution: Slackware 12
Posts: 8

Rep: Reputation: 0
About implementation of "monitor" in C++


Hi everybody;

I want to use monitors in a multi-threaded program for synchronization. I have written some piece of codes, but I wonder whether there is any commonly-used implementation of monitor concept in C++. I have searched for that over the net and have found too many different implementation. But I couldn't trust them, is there any well-known library like boost for implementation of monitor?

Thanks

Yatko

Last edited by nalsrayatko; 12-01-2007 at 11:57 AM.
 
Old 12-03-2007, 03:11 AM   #2
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Remind me. Is a Monitor another name for a condition variable?
 
Old 12-03-2007, 05:29 AM   #3
nalsrayatko
LQ Newbie
 
Registered: Nov 2007
Distribution: Slackware 12
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by dmail View Post
Remind me. Is a Monitor another name for a condition variable?
Yes, they are related with each other. But a monitor is kind of concept and has some rules. You can implement it by using mutexes and condition variables. I can code it myself, but I want to learn whether there is a well-known base class implementation. So if you want to a specific implementation, you just derive it from base class and do some modifications .

For example, at the beginning I was using pthread library in my program. Then I want to write my own thread class, but I see that there is already a well-implemented library, named boost thread library.
 
Old 12-04-2007, 09:58 AM   #4
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
But a monitor is kind of concept and has some rules
Really? this is something I was not aware of.
Quote:
... I want to learn whether there is a well-known base class implementation. So if you want to a specific implementation, you just derive it from base class and do some modifications . ... boost thread library.
As far as I know there is not, yet next year in C++Ox there may well be. With regards to Boost I am sure what you are looking for is neither there or ever would be, it simply supplies the tools for you to implement it your self (the logic that is) as does POSIX threads and Windows threads.
 
Old 12-04-2007, 01:25 PM   #5
nalsrayatko
LQ Newbie
 
Registered: Nov 2007
Distribution: Slackware 12
Posts: 8

Original Poster
Rep: Reputation: 0
Ok. I see, it is better for me to write them all and if you wish you can find more things about monitor in the link below.

Monitor
 
  


Reply

Tags
monitor, pthread, semaphore


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 12:26 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 04:07 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 09:31 AM
Switch from 17" monitor to 15" monitor. Need to know how to change settings. DoThatPlan Linux - Hardware 1 04-14-2004 09:11 PM


All times are GMT -5. The time now is 01:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration