thread.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * WinPR: Windows Portable Runtime
  3. * Process Thread Functions
  4. *
  5. * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
  6. * Copyright 2015 Hewlett-Packard Development Company, L.P.
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. #ifndef WINPR_THREAD_PRIVATE_H
  21. #define WINPR_THREAD_PRIVATE_H
  22. #ifndef _WIN32
  23. #include <pthread.h>
  24. #include <winpr/thread.h>
  25. #include "../handle/handle.h"
  26. typedef void* (*pthread_start_routine)(void*);
  27. struct winpr_thread
  28. {
  29. WINPR_HANDLE_DEF();
  30. BOOL started;
  31. int pipe_fd[2];
  32. BOOL mainProcess;
  33. BOOL detached;
  34. BOOL joined;
  35. BOOL exited;
  36. DWORD dwExitCode;
  37. pthread_t thread;
  38. SIZE_T dwStackSize;
  39. LPVOID lpParameter;
  40. pthread_mutex_t mutex;
  41. pthread_mutex_t threadIsReadyMutex;
  42. pthread_cond_t threadIsReady;
  43. LPTHREAD_START_ROUTINE lpStartAddress;
  44. LPSECURITY_ATTRIBUTES lpThreadAttributes;
  45. #if defined(WITH_DEBUG_THREADS)
  46. void* create_stack;
  47. void* exit_stack;
  48. #endif
  49. };
  50. typedef struct winpr_thread WINPR_THREAD;
  51. struct winpr_process
  52. {
  53. WINPR_HANDLE_DEF();
  54. pid_t pid;
  55. int status;
  56. DWORD dwExitCode;
  57. };
  58. typedef struct winpr_process WINPR_PROCESS;
  59. #endif
  60. #endif /* WINPR_THREAD_PRIVATE_H */