pthread.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 of the License.
  11. *
  12. * In addition, as a special exception, the copyright holders give
  13. * permission to link the code of this library and its programs with the
  14. * OpenSSL library, and distribute linked combinations including the two.
  15. *
  16. * libs3 is distributed in the hope that it will be useful, but WITHOUT ANY
  17. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  18. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public License
  22. * version 3 along with libs3, in a file named COPYING. If not, see
  23. * <http://www.gnu.org/licenses/>.
  24. *
  25. ************************************************************************** **/
  26. #ifndef PTHREAD_H
  27. #define PTHREAD_H
  28. #ifdef WINSCP
  29. #include <windows.h>
  30. #include <tchar.h>
  31. #include <stdio.h>
  32. #endif
  33. // This is a minimal implementation of pthreads on Windows, implementing just
  34. // the APIs needed by libs3
  35. unsigned long pthread_self();
  36. typedef struct
  37. {
  38. CRITICAL_SECTION criticalSection;
  39. } pthread_mutex_t;
  40. int pthread_mutex_init(pthread_mutex_t *mutex, void *);
  41. int pthread_mutex_lock(pthread_mutex_t *mutex);
  42. int pthread_mutex_unlock(pthread_mutex_t *mutex);
  43. int pthread_mutex_destroy(pthread_mutex_t *mutex);
  44. #ifdef WINSCP
  45. char* strtok_r(
  46. char *str,
  47. const char *delim,
  48. char **nextp);
  49. #endif
  50. #endif /* PTHREAD_H */