Andrea Canciani <ranm...@gmail.com> writes:

> I have some work on memleak related issues:
>
> http://cgit.freedesktop.org/~ranma42/pixman/commit/?h=wip/simpleops-to-master&id=77db90242f7b7f12c5792480a10eb3a448e6c55f
> and
> http://cgit.freedesktop.org/~ranma42/pixman/commit/?h=wip/simpleops-to-master&id=ca41228a66fe9bbec354cdef034c144ce1619793
>
> Do you think it might be worth to revive it and cleanup for review & merge?
> Unfortunately they depend on simpleops, a header-library I wrote to
> abstract (from compiler/platform) some low-level operations, like atomic
> arithmetics, mutexes, threads and library constructors/destructors.
> (currently all of them except init/fini are available in C11 and the
> simpleops API tries to be as similar to C11 as possible, to ease C11-based
> implementations and to make it easy to get rid of the simpleops dependency
> when C11 support is sufficiently widespread).
> Would it be ok to have it as dependency?

At some point pixman probably needs to become multithreaded and then we
will need some abstraction for these low-level operations.

I think I have mentioned before that it might be a good idea to have an
MIT licensed utility library that could contain these lowlevel
operations along with things like linked lists and growable
arrays. Until simpleops grows into such a library, I think I'd prefer to
keep the abstractions inside pixman, though those internal abstractions
could potentially be based on code from simpleops.

There is also a general issue with header libraries: they have
potentialy complicated ABI issues because the code is inlined into all
users, so if any aspect of the code changes, you have to recompile
everything.

Looking briefly at the simpleops code, I noticed a few things:

- There doesn't appear to be support for __thread for thread local
  variables.

- It's a bit difficult to understand all the headers that include each
  other. (The proliferation of headers is something that I never liked
  about the cairo code as well). Would it be possible to just have one
  header per platform -- ie., simpleops-win32.h, simpleops-posix, ...?

- There is no way to statically initialize a mutex. I realize that
  that's because Windows doesn't offer this feature, but without it, 
  you need some kind of library initialization routine.

  I wrote some notes here:

      
http://cgit.freedesktop.org/~sandmann/pixman/tree/docs/thread-primitives?h=docs

  about how you could emulate them on Windows.

- If/when we get serious about multithreading in pixman, we'd likely
  need support for condition variables, and on Linux possibly handroll
  the thread primitives based on futex() and clone() without using
  pthreads.


Søren
_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to