Summary: | res_pixmap.c thread issue | ||
---|---|---|---|
Product: | MuPDF | Reporter: | Pedro Rivera <pedro.rivera.651> |
Component: | fitz | Assignee: | Tor Andersson <tor.andersson> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | danwaleke, zeniko |
Priority: | P4 | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Customer: | Word Size: | --- |
Description
Pedro Rivera
2011-04-19 21:56:12 UTC
Ignoring the fact that the code indeed isn't thread safe, this looks rather like a case of too low a limit for your case. IIRC, the limit is supposed to be global (after all, your computer doesn't get more memory when rendering more documents in parallel) - so you'll rather want to make it match what your machine can reasonably handle. Also, not every MuPDF consumer will allocate images on the same thread as they're released (we don't), so per-thread variables aren't a general enough solution. As with the static FreeType references, we'd need a context struct that contains these values and where we can control ourselves whether it applies per thread, per document or globally (with locking in place in our code). What are the chances of making MuPDF thread safe? I have wrapped the library in a simple win32 DLL that can be PInvoked from managed c# code. Occastionally the code is called by different threads in the application. The application crashes because of the global static FreeType reference. I have changed this in my code, but I am no c developer. I'd prefer if someone that maintains the library could make this a priority. Side note: I love mupdf. Just wish it was thread safe. (In reply to comment #2) Dan, If you are doing C# you might want to look at JMuPDF which is a Java wrapper around MUPDF toolkit. This project already addresses several thread issues. With some minor changes I bet you can get a C# version going. The project is on SourceForge. Just a thought. Good luck. Pedro > What are the chances of making MuPDF thread safe? > > I have wrapped the library in a simple win32 DLL that can be PInvoked from > managed c# code. Occastionally the code is called by different threads in the > application. The application crashes because of the global static FreeType > reference. > > I have changed this in my code, but I am no c developer. I'd prefer if someone > that maintains the library could make this a priority. > > Side note: I love mupdf. Just wish it was thread safe. *** This bug has been marked as a duplicate of bug 692023 *** |