This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: replace mutex with object synchronization


Anthony Green wrote:

Since I've been looking at libgcj's use of posix threads I came across
this bit of code which uses _Jv_Mutex_t to synchronize access to a data
structure.  This is guaranteed to use the underlying system's mutex
primitives.  We can do a little better by using object synchronization
and our own lightweight locks.

Perhaps this is a micro-optimization, but it also collapses the locking
code down from three places to a single code fragment.


The reason I used the _Jv_Mutex_t here is due to the "low-level" nature of the class linking code. We need to create an instance of Object in order to use Java locks, so what happens if we're already in the middle of linking the Object class? I guess it doesn't matter right now, since libgcj itself isn't built with the BC-ABI, but eventually, using Java locks here could potentially lead to circularity problems.


Regards

Bryce



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]