pthread.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /** **************************************************************************
  2. * pthread.h
  3. *
  4. * Copyright 2008 Bryan Ischo <[email protected]>
  5. *
  6. * This file is part of libs3.
  7. *
  8. * libs3 is free software: you can redistribute it and/or modify it under the
  9. * terms of the GNU Lesser General Public License as published by the Free
  10. * Software Foundation, version 3 or above of the License. You can also
  11. * redistribute and/or modify it under the terms of the GNU General Public
  12. * License, version 2 or above of the License.
  13. *
  14. * In addition, as a special exception, the copyright holders give
  15. * permission to link the code of this library and its programs with the
  16. * OpenSSL library, and distribute linked combinations including the two.
  17. *
  18. * libs3 is distributed in the hope that it will be useful, but WITHOUT ANY
  19. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  20. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  21. * details.
  22. *
  23. * You should have received a copy of the GNU Lesser General Public License
  24. * version 3 along with libs3, in a file named COPYING. If not, see
  25. * <https://www.gnu.org/licenses/>.
  26. *
  27. * You should also have received a copy of the GNU General Public License
  28. * version 2 along with libs3, in a file named COPYING-GPLv2. If not, see
  29. * <https://www.gnu.org/licenses/>.
  30. *
  31. ************************************************************************** **/
  32. #ifndef PTHREAD_H
  33. #define PTHREAD_H
  34. #ifdef WINSCP
  35. #include <windows.h>
  36. #include <tchar.h>
  37. #include <stdio.h>
  38. #endif
  39. // This is a minimal implementation of pthreads on Windows, implementing just
  40. // the APIs needed by libs3
  41. unsigned long pthread_self();
  42. typedef struct
  43. {
  44. CRITICAL_SECTION criticalSection;
  45. } pthread_mutex_t;
  46. int pthread_mutex_init(pthread_mutex_t *mutex, void *);
  47. int pthread_mutex_lock(pthread_mutex_t *mutex);
  48. int pthread_mutex_unlock(pthread_mutex_t *mutex);
  49. int pthread_mutex_destroy(pthread_mutex_t *mutex);
  50. #ifdef WINSCP
  51. char* strtok_r(
  52. char *str,
  53. const char *delim,
  54. char **nextp);
  55. #endif
  56. #endif /* PTHREAD_H */