Re: 'The Global xref table' ... (fwd)




Hi Guys, 

	I have no desire to go through the xpdf code solving the problem
in the near future. The mutex works, and is very self contained. It
protects all the PDF 'library' functions and nothing else. Derek is kindly
considering it as we write, so there is no need for precipitate code
mangling action :-)

	Here is what he wrote to me:

		Michael.

-- 
 michael@imaginator.com  <><, Pseudo Engineer, itinerant idiot

---------- Forwarded message ----------
Date: Tue, 24 Aug 1999 10:51:51 -0700
From: Derek B. Noonburg <derekn@foolabs.com>
To: michael@imaginator.com
Cc: derekn@foolabs.com
Subject: Re: 'The Global xref table' ...

>:-) I don't have any good ideas, I was thinking of tacking it
> Object, then I thought of passing it via fetch, then ... :-) Anyway, as
> long as I know about it its fine. I've added a save / restore XRef wrapper
> around my calls to renderPage and that works fine, I'll implement a
> locking layer above it if I can to stop more than one threead getting into
> the PDF stuff until we get a better solution. It'll give me a chance to
> test / implement Bonobo's locking mechanisms :-)

Are you doing one thread per document?

Is there some way to store per-thread global variables?  I thought
there was, but I haven't done a lot of multithreaded programming.

Maybe putting a lock around the rendering code is the easiest
solution.  Beware that you need to acquire the lock anytime you look
at the document -- for example, I think following a link can also use
the xref table.

> 	I'll forward your mail to Miguel if I may to explain the situation
> ?

Sure, go ahead.  I'll let you forward this email too, since it won't
make much sense without the earlier one.

> PS. Any solution to this is going to involve a lot of method updates to
> pass a pointer around, but does it really have to go everywhere ? :-)

[Warning: the following is from memory...]

It mainly has to get to XRef::fetch(), but that's called from
Object::fetch(), which is called from lots of places.  I don't really
want to add an xref field to Object -- I'm trying to keep Objects as
small as possible because they get passed directly (not with pointers)
a lot.

This is something I'd like to fix (it's been on my list forever), so
we should be able to figure something out.  I'll look through the code
and figure out where the xref is used.  The passing-it-everywhere
solution might not be quite as bad as I think.

- Derek



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]