nxthread.h 844 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "nx/nxapi.h"
  3. #ifndef WIN32_LEAN_AND_MEAN
  4. #define WIN32_LEAN_AND_MEAN
  5. #endif
  6. #include <windows.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. typedef struct nx_thread_struct_t { size_t dummy; } *nx_thread_t;
  11. typedef DWORD nx_thread_return_t;
  12. typedef void *nx_thread_parameter_t;
  13. #define NXTHREADCALL CALLBACK
  14. typedef nx_thread_return_t (NXTHREADCALL *nx_thread_func_t)(nx_thread_parameter_t parameter);
  15. // TODO: add parameters for things like stack size
  16. NX_API int NXThreadCreate(nx_thread_t *thread, nx_thread_func_t thread_function, nx_thread_parameter_t parameter);
  17. NX_API int NXThreadJoin(nx_thread_t t, nx_thread_return_t *retval);
  18. enum
  19. {
  20. NX_THREAD_PRIORITY_PLAYBACK=THREAD_PRIORITY_HIGHEST,
  21. };
  22. // sets priority of current thread
  23. NX_API int NXThreadCurrentSetPriority(int priority);
  24. #ifdef __cplusplus
  25. }
  26. #endif