Loading

Paste #pl3pqzcke

  1. diff --git a/libphobos/libdruntime/gcc/gthreads/posix.d b/libphobos/libdruntime/gcc/gthreads/posix.d
  2. index 15714dd..cc357f9 100644
  3. --- a/libphobos/libdruntime/gcc/gthreads/posix.d
  4. +++ b/libphobos/libdruntime/gcc/gthreads/posix.d
  5. @@ -24,7 +24,44 @@ module gcc.gthreads.posix;
  6.  // POSIX threads specific definitions.
  7.  // Easy, since the interface is just one-to-one mapping.
  8.  
  9. -import core.sys.posix.pthread;
  10. +version (Posix)
  11. +{
  12. +    import core.sys.posix.pthread;
  13. +}
  14. +else version (MinGW)
  15. +{
  16. +    // using the winpthreads library
  17. +    import core.stdc.config;
  18. +
  19. +    alias c_uint = uint;
  20. +    alias c_int = int;
  21. +    alias pthread_key_t = c_uint;
  22. +    alias pthread_once_t = c_long;
  23. +    alias pthread_mutex_t = void*;
  24. +    alias pthread_mutexattr_t = c_uint;
  25. +    enum PTHREAD_MUTEX_INITIALIZER = cast(pthread_mutex_t)cast(size_t)-1;
  26. +    enum PTHREAD_ONCE_INIT = 0;
  27. +    enum PTHREAD_MUTEX_RECURSIVE = 2;
  28. +
  29. +    extern(C) nothrow /*export*/
  30. +    {
  31. +        c_int pthread_once(pthread_once_t*, void function());
  32. +        c_int pthread_key_create(pthread_key_t*, void function(void*));
  33. +        c_int pthread_key_delete(pthread_key_t);
  34. +        void* pthread_getspecific(pthread_key_t);
  35. +        c_int pthread_setspecific(pthread_key_t, in void*);
  36. +        c_int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
  37. +        c_int pthread_mutex_destroy(pthread_mutex_t*);
  38. +        c_int pthread_mutex_lock(pthread_mutex_t*);
  39. +        c_int pthread_mutex_trylock(pthread_mutex_t*);
  40. +        c_int pthread_mutex_unlock(pthread_mutex_t*);
  41. +
  42. +        c_int pthread_mutexattr_init(pthread_mutexattr_t*);
  43. +        c_int pthread_mutexattr_settype(pthread_mutexattr_t*, c_int);
  44. +        c_int pthread_mutexattr_destroy(pthread_mutexattr_t*);
  45. +    }
  46. +}
  47. +else static assert(false, "Unsupported operating system");
  48.  
  49.  alias gthread_key_t   = pthread_key_t;
  50.  alias gthread_once_t  = pthread_once_t;