[Bug 754027] New: Don't use C constructors for initializing critical sections on Windows

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Mon Aug 24 07:39:29 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=754027

            Bug ID: 754027
           Summary: Don't use C constructors for initializing critical
                    sections on Windows
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: orc
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: nirbheek.chauhan at gmail.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
                CC: ds at schleef.org
     GNOME version: ---

Created attachment 309924
  --> https://bugzilla.gnome.org/attachment.cgi?id=309924&action=edit
Don't use C constructors for initializing critical sections on Windows

Instead, use memory barriers and just initialize it as part of orc_init().
Also, require that some sort of threading library be available.

C constructors are toolchain-specific which brings its own set of problems.
There's no guarantees about the order in which C constructors are called, it
makes it impossible to use static libraries built with one toolchain on another
one, and so on.

Finally, C constructors are only useful when you need a single point of entry
for initializing data shared throughout the library. Orc already has a function
for doing that; namely orc_init(), so we can just use that.

The atomic set/get of cs_inited using MemoryBarrier() was inspired by GLib's
g_atomic_int_set/get implementation.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list