Update of /cvsroot/boost/boost/boost/thread/win32
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27511
Modified Files:
Tag: thread_rewrite
read_write_mutex.hpp
Log Message:
Increased count limits to use all available space in state field; extracted
create_anonymous_event; ensure shared event is correctly
set
Index: read_write_mutex.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/thread/win32/Attic/read_write_mutex.hpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- read_write_mutex.hpp 17 Oct 2006 17:22:57 -0000 1.1.2.7
+++ read_write_mutex.hpp 18 Oct 2006 13:15:41 -0000 1.1.2.8
@@ -17,9 +17,9 @@
void* upgradeable_event;
BOOST_STATIC_CONSTANT(long,shared_count_increment=1);
- BOOST_STATIC_CONSTANT(long,shared_count_mask=0x1fff);
- BOOST_STATIC_CONSTANT(long,exclusive_count_mask=0x1ffe00);
- BOOST_STATIC_CONSTANT(long,exclusive_count_increment=0x2000);
+ BOOST_STATIC_CONSTANT(long,shared_count_mask=0x7fff);
+ BOOST_STATIC_CONSTANT(long,exclusive_count_mask=0x1fff8000);
+ BOOST_STATIC_CONSTANT(long,exclusive_count_increment=0x8000);
BOOST_STATIC_CONSTANT(long,shared=0x20000000);
BOOST_STATIC_CONSTANT(long,upgradeable=0x40000000);
BOOST_STATIC_CONSTANT(long,exclusive=0x80000000);
@@ -48,21 +48,28 @@
return old_state;
}
- enum{
+ enum event_type
+ {
auto_reset=false,
manual_reset=true
};
- enum{
+ enum initial_event_state
+ {
initially_set=true,
initially_reset=false
};
+ void* create_anonymous_event(event_type type,initial_event_state
initial_state)
+ {
+ return ::boost::detail::CreateEventA(NULL,type,initial_state,NULL);
+ }
+
public:
read_write_mutex():
state(0),
-
shared_event(::boost::detail::CreateEventA(NULL,manual_reset,initially_set,NULL)),
-
exclusive_event(::boost::detail::CreateEventA(NULL,auto_reset,initially_reset,NULL)),
-
upgradeable_event(::boost::detail::CreateEventA(NULL,auto_reset,initially_set,NULL))
+ shared_event(create_anonymous_event(manual_reset,initially_set)),
+
exclusive_event(create_anonymous_event(auto_reset,initially_reset)),
+
upgradeable_event(create_anonymous_event(auto_reset,initially_set))
{}
~read_write_mutex()
@@ -247,11 +254,8 @@
long old_state=update_state<upgradeable|shared,exclusive,
shared_count_mask|exclusive_count_mask,shared_count_increment-exclusive_count_increment,
0,false>(exclusive|exclusive_count_increment);
- if(old_state&shared_count_mask)
- {
- bool const success=::boost::detail::SetEvent(shared_event)!=0;
- BOOST_ASSERT(success);
- }
+ bool const success=::boost::detail::SetEvent(shared_event)!=0;
+ BOOST_ASSERT(success);
}
void unlock_and_lock_shareable()
@@ -259,21 +263,13 @@
long old_state=update_state<shared,exclusive,
shared_count_mask|exclusive_count_mask,shared_count_increment-exclusive_count_increment,
0,false>(exclusive|exclusive_count_increment);
- if(old_state&shared_count_mask)
- {
- bool const success=::boost::detail::SetEvent(shared_event)!=0;
- BOOST_ASSERT(success);
- }
+ bool const success=::boost::detail::SetEvent(shared_event)!=0;
+ BOOST_ASSERT(success);
}
void unlock_upgradeable_and_lock_shareable()
{
long
old_state=update_state<0,upgradeable,0,0,0,false>(upgradeable|shared|shared_count_increment);
- if((old_state&shared_count_mask)!=shared_count_increment)
- {
- bool const success=::boost::detail::SetEvent(shared_event)!=0;
- BOOST_ASSERT(success);
- }
bool const success=::boost::detail::SetEvent(upgradeable_event)!=0;
BOOST_ASSERT(success);
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs