1. 21 Jul, 2021 1 commit
    • Emmanuel Fleury's avatar
      Fix cast from pointer to integer of different size warnings in glib/gthread-win32.c · 28dcec03
      Emmanuel Fleury authored
      glib/gthread-win32.c: In function 'g_private_get_impl':
      glib/gthread-win32.c:310:16: warning: cast from pointer to integer of different size
         DWORD impl = (DWORD) key->p;
      glib/gthread-win32.c:315:14: warning: cast from pointer to integer of different size
             impl = (DWORD) key->p;
      glib/gthread-win32.c: In function 'SetThreadName':
      glib/gthread-win32.c:596:60: warning: passing argument 4 of 'RaiseException' from incompatible pointer type
          RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (DWORD *) &info);
  2. 10 Jun, 2021 1 commit
    • Yongsu Park's avatar
      win32: Check and avoid using TLS index 0 · 3364e020
      Yongsu Park authored and Philip Withnall's avatar Philip Withnall committed
      Zero is a valid TLS index so it needs to be checked. It’s also the
      integer used to indicate that no TLS has been allocated yet, so it can’t
      be used as a TLS identifier.
      Incorporates changes from Philip Withnall.
      Fixes: #2058
  3. 14 Jan, 2021 1 commit
  4. 05 Jan, 2021 1 commit
  5. 20 Nov, 2020 1 commit
  6. 30 Sep, 2020 1 commit
  7. 12 Jun, 2020 1 commit
    • Philip Withnall's avatar
      tree: Fix various typos and outdated terminology · 00bfb3ab
      Philip Withnall authored
      This was mostly machine generated with the following command:
      codespell \
          --builtin clear,rare,usage \
          --skip './po/*' --skip './.git/*' --skip './NEWS*' \
          --write-changes .
      using the latest git version of `codespell` as per [these
      Then I manually checked each change using `git add -p`, made a few
      manual fixups and dropped a load of incorrect changes.
      There are still some outdated or loaded terms used in GLib, mostly to do
      with git branch terminology. They will need to be changed later as part
      of a wider migration of git terminology.
      If I’ve missed anything, please file an issue!
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
  8. 19 Jan, 2020 1 commit
  9. 15 Jan, 2020 2 commits
    • Sebastian Dröge's avatar
      GThreadPool - Don't inherit thread priorities when creating new threads · 8aeca4fa
      Sebastian Dröge authored
      By default (on POSIX) we would be inheriting thread priorities from the
      thread that pushed a new task on non-exclusive thread pools and causes a
      new thread to be created. This can cause any non-exclusive thread pool
      to accidentally contain threads of different priorities, or e.g. threads
      with real-time priority.
      To prevent this, custom handling for setting the scheduler settings for
      Linux and Windows is added and as a fallback for other platforms a new
      thread is added that is responsible for spawning threads for
      non-exclusive thread pools.
      Fixes #1834
    • Sebastian Dröge's avatar
      GThread - Inherit parent thread priority by default for new Win32 threads · be537d8b
      Sebastian Dröge authored
      This is the default behaviour on POSIX and having different behaviour
      between the two GThread implementations could lead to subtle problems.
  10. 31 Jan, 2019 1 commit
    • Colin Walters's avatar
      gthread: Rework to avoid holding a mutex half the time · 630fa82e
      Colin Walters authored and Philip Withnall's avatar Philip Withnall committed
      This code was a persistent source of `-fsanitize=thread` errors
      when I was trying to use it on OSTree.
      The problem is that while I think this code is functionally correct,
      we hold a mutex during the writes, but not the reads, and TSAN (IMO
      correctly) flags that.
      Reading this, I don't see a reason we need a mutex at all.  At the
      cost of some small code duplication between posix/win32, we can just
      pass the data we need down into each implementation.  This ends up
      being notably cleaner I think than the awkward "lock/unlock to
      serialize" dance.
      (Minor review changes made by Philip Withnall <withnall@endlessm.com>.)
  11. 29 May, 2018 1 commit
  12. 27 May, 2018 1 commit
    • Christoph Reiter's avatar
      win32: make g_cond_wait_until() wait at least until end_time before returning... · 583fb1a3
      Christoph Reiter authored
      win32: make g_cond_wait_until() wait at least until end_time before returning with a timeout. See #1371
      The tests in test_async_queue_timed() assume that g_async_queue_timeout_pop()
      and in turn g_cond_wait_until() wait at least until end_time
      before returning, i.e. calling g_get_monotonic_time() after the timeout should result
      in a value equal or larger than the timeout end time.
      For the win32 implementation of g_cond_wait_until() this isn't the case which
      makes those tests fail.
      There are three reasons why the function returns early:
      1) The underlying API works with milliseconds and the timeout gets rounded
         down, resulting in a too small timeout value.
      2) In case the timeout is too large to be passed to the API it gets limited
         (there is also a bug because it converts INFINITE to milliseconds while
         they already are, but using INFINITE would be wrong as well, as passing
         a large timeout is not the same as blocking forever really)
      3) Even with the rounding changed the underlying API still returns a bit early
         sometimes on my machine (relative to g_get_monotonic_time())
      This changes the implementation to round up to the next millisecond (fixing 1)
      and to wait again in case a timeout occurs but the end time hasn't been
      reached yet (fixing 2 and 3).
      This makes the test_async_queue_timed() tests pass.
  13. 24 May, 2017 1 commit
    • Sébastien Wilmet's avatar
      glib/: LGPLv2+ -> LGPLv2.1+ · f9faac76
      Sébastien Wilmet authored
      All glib/*.{c,h} files have been processed, as well as gtester-report.
      12 of those files are not licensed under LGPL:
      Some of them are generated files, some are licensed under a BSD-style
      license and win_iconv.c is in the public domain.
      Sub-directories inside glib/:
      	deprecated/: processed in a previous commit
      	glib-mirroring-tab/: already LGPLv2.1+
      	gnulib/: not modified, the code is copied from gnulib
      	libcharset/: a copy
      	pcre/: a copy
      	tests/: processed in a previous commit
  14. 27 Apr, 2016 1 commit
  15. 26 Apr, 2016 1 commit
    • LRN's avatar
      Add g_system_thread_set_name() implementation for W32 threads · e1188564
      LRN authored
      This works by using semi-documented[1] exception to tell the debugger
      that a thread needs to have its name changed.
      If this exception is not caught and handled by something, it will crash
      the process, so we need to set up our own handler in case there's no
      debugger attached or the debugger can't handle this type of exception.
      Since SEH is not supported by gcc on i686 (at the moment), we need to use VEH
      instead. For completeness the MSVC-oriented code still uses SEH, although
      there is no reason why it shouldn't work with the VEH variant used by MinGW.
      VEH handler has to be set up somewhere (g_thread_win32_init () works nicely)
      and removed once it's not needed (g_thread_win32_process_detach () is added
      expressly for that purpose). Note that g_thread_win32_process_detach() is
      only called when glib is unloaded by FreeLibrary(), not when glib-using
      process is terminating.
      This exception is known to work with WinDbg, and adding support for it into
      GDB proved to be feasible (GDB patch will be sent upstream, eventually).
      [1] https://msdn.microsoft.com/en-us/library/xcb2z8hs%28v=vs.71%29.aspx
  16. 31 Jan, 2014 1 commit
  17. 02 Jul, 2013 1 commit
  18. 30 Jun, 2013 1 commit
  19. 18 Jan, 2013 1 commit
  20. 15 Nov, 2012 1 commit
  21. 09 Feb, 2012 1 commit
  22. 22 Dec, 2011 1 commit
    • rodrigorivascosta's avatar
      Bug 666551-Fix a few dangling pointers · 1b033774
      rodrigorivascosta authored
      When removing an item from the list, check the next one's my_owner,
      and fix it accordingly. And take this case into account when last
      of the list is deleted.
      Also, assign NULL to 'my_owner' in g_thread_xp_WakeConditionVariable.
  23. 19 Dec, 2011 1 commit
    • Allison Karlitskaya's avatar
      winxp threads: fix some condition variable races · 541693f4
      Allison Karlitskaya authored
      There are some races in the condition variable emulation code for
      Windows XP with respect to timeouts while waiting.
      First, in the event of a timeout, we never remove the waiter from the
      condition variable.  This can cause crashes later.  That problem was
      found by Rodrigo Rivas Costa.
      Second, if the waiting thread times out and exits just as we were about
      to call SetEvent() on its waiter event, we could end up trying to access
      the waiter after it was closed/freed.  We need to hold on to the lock a
      little bit longer to ensure that that's not possible.
  24. 16 Dec, 2011 1 commit
  25. 03 Nov, 2011 1 commit
  26. 18 Oct, 2011 2 commits
  27. 17 Oct, 2011 1 commit
  28. 14 Oct, 2011 1 commit
    • Allison Karlitskaya's avatar
      GCond: use monotonic time for timed waits · 4033c616
      Allison Karlitskaya authored
      Switch GCond to using monotonic time for timed waits by introducing a
      new API based on monotonic time in a gint64: g_cond_wait_until().
      Deprecate the old API based on wallclock time in a GTimeVal.
      Fix up the gtk-doc for GCond while we're at it: update the examples to
      use static-allocated GCond and GMutex and clarify some things a bit.
      Also explain the rationale behind using an absolute time instead of a
      relative time.
  29. 13 Oct, 2011 10 commits