sema.h 924 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. * This component and the accompanying materials are made available
  5. * under the terms of the License "Eclipse Public License v1.0"
  6. * which accompanies this distribution, and is available
  7. * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. *
  9. * Initial Contributors:
  10. * Nokia Corporation - initial contribution.
  11. *
  12. * Contributors:
  13. *
  14. * Description:
  15. *
  16. */
  17. #ifndef _SEMA_H_
  18. #define _SEMA_H_
  19. #ifdef WIN32
  20. #include <windows.h>
  21. #include <tlhelp32.h>
  22. #else
  23. #include <semaphore.h>
  24. #include <sys/types.h>
  25. #endif
  26. typedef struct
  27. {
  28. char *name;
  29. #ifdef WIN32
  30. HANDLE handle;
  31. #else
  32. sem_t *handle;
  33. #endif
  34. unsigned int timeout;
  35. } sbs_semaphore;
  36. void sema_create(sbs_semaphore *s);
  37. void sema_destroy(sbs_semaphore *s);
  38. int sema_wait(sbs_semaphore *s);
  39. void sema_release(sbs_semaphore *s);
  40. int sema_wait(sbs_semaphore *s);
  41. #endif