473,769 Members | 8,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about Boost Mutex Implementation

I was browsing through the souce code for the boost mutex
implementation just to understand how the library works. I get the
basic idea: a mutex object is associated with a scoped_lock object.
The scoped_lock object calls private member functions of the mutex,
specifically mutex::do_lock and mutex::do_unloc k via static functions
defined in the lock_ops class.

My question is, where is the actual platform-specific call to actually
lock the mutex primitive, e.g. the call to pthread_mutex_l ock? In the
boost source code, in the mutex.hpp file, the private member function
do_lock() is declared but not actually defined. Where is the code
that actually calls the platform-specific lock function?

Oct 8 '07 #1
1 3247
ch******@gmail. com wrote:
I was browsing through the souce code for the boost mutex
implementation just to understand how the library works. I get the
basic idea: a mutex object is associated with a scoped_lock object.
The scoped_lock object calls private member functions of the mutex,
specifically mutex::do_lock and mutex::do_unloc k via static functions
defined in the lock_ops class.

My question is, where is the actual platform-specific call to actually
lock the mutex primitive, e.g. the call to pthread_mutex_l ock? In the
boost source code, in the mutex.hpp file, the private member function
do_lock() is declared but not actually defined. Where is the code
that actually calls the platform-specific lock function?
http://www.google.com/codesearch?hl=...package:boost+
do_lock+show:A3 9GR61BV8A:-PObAh4uKr8:6IDZ IkSVSO4&sa=N&cd =5&ct=rc&cs_p=c vs+
:pserver:anonym ous%40boost.cvs .sourceforge.ne t:/cvsroot/boost-sandbox
+boost-sandbox&cs_f=bo ost/shmem/sync/posix/shared_mutex.hp p#first

[rebuild the link]

Regards,

Zeppe
Oct 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1048
by: Alejandro Lapeyre | last post by:
I am starting to implement the DOM in .Net. And here comes my first two "dilemas" (questions): 1). In .Net is common and suggested to use ProperCase to define methods. Is acceptable for a DOM implementation to use, for example, TagName instead of tagName ?
193
9643
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I speak only of features in the spirit of C; something like object-orientation, though a nice feature, does not belong in C. Something like being able to #define a #define would be very handy, though, e.g: #define DECLARE_FOO(bar) #define...
0
1492
by: VB Programmer | last post by:
I am going to use an ActiveX control on my webform. 1. How can I set it up so that if a user views the web page and doesn't have the ActiveX control it immediately/automatically downloads it from a predefined location? 2. How do I handle registering it on their machine (with 'regsvr32'?), or do I even need to do this? (This ActiveX control is an unmanaged, non-server control.)
4
1247
by: m_palmer45 | last post by:
Hi, I was looking at the code in the standard lib's mutex.py, which is used for queuing function calls. Here is how it lets you acquire a lock: def testandset(self): """Atomic test-and-set -- grab the lock if it is not set, return True if it succeeded.""" if not self.locked: self.locked = 1
5
3166
by: Brian Hampson | last post by:
I'm new to getting multi-threading working in C#, so I'm looking for some help with Mutexes. I have code that looks like the following: Mutex MyMutex = new Mutex();
3
6816
by: =?iso-8859-1?B?Tm9yZGz2dw==?= | last post by:
Hey there, C++ Coders! I am learning multi-threading with boost and have come up with the following code example shown below. This example implements a test of the producer-consumer design pattern. gcc-4.1.2 however complains with errors about my use of boost::bind(). Doesn't bind support this way of specifying a function and its arguments or should I solve it in another way?
1
1318
by: Sarada Prasanna | last post by:
Hi, I have 2 databases(SampleA and SampleB) fully loaded on server A. Now, I need to create DPF environment on Server A (Logical partitioning). Now, if I modify the file db2nodes.cfg as follows, nodenum hostname logical-port 1 serverA 0 2 serverA 1 3 serverA 2 4 serverA 3
3
2377
by: Lars Uffmann | last post by:
I have this wxWidgets OnButtonClick event handler, that apparently holds a lock on all widgets in my form, but this event handler is supposed to end a thread in the background - while that thread is supposed to update widget content. So if I want to wait for the thread to end in the event handler, I have 2 threads waiting on each other - with the one in the background waiting to access the widget content. My current workaround is to...
19
3398
by: =?ISO-8859-1?Q?Nordl=F6w?= | last post by:
I am currently designing a synchronized queue used to communicate between threads. Is the code given below a good solution? Am I using mutex lock/unlock more than needed? Are there any resources out there on the Internet on how to design *thread-safe* *efficient* data- structures? /Nordlöw
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.