[kaffe] CVS kaffe (robilad): Fixed synchronization problems when opening ZipFiles
Mark Wielaard
mark at klomp.org
Wed Jan 5 17:01:05 PST 2005
Hi,
On Wed, 2005-01-05 at 14:49 -0800, Kaffe CVS wrote:
> public ZipFile(String fname) throws IOException
> {
> name = fname;
> - zip = openZipFile0(fname);
> + /* only have one thread at a time attempt to open the zip file */
> + synchronized(fname) {
> + zip = openZipFile0(fname);
> + }
Note that strings don't have to be unique objects. You might want to do
a fname = fname.intern() first to be sure. And depending on how
openZipFile0 works (I haven't actually checked) you might want to make
sure that it recognizes different paths to the same file correctly.
The safest would be to just synchronize on ZipFile.class
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://kaffe.org/pipermail/kaffe/attachments/20050106/aa84e319/attachment-0002.pgp
More information about the kaffe
mailing list