port.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ident "ldclt @(#)port.c 1.2 01/03/14"
  2. /** BEGIN COPYRIGHT BLOCK
  3. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  4. * Copyright (C) 2006 Red Hat, Inc.
  5. * All rights reserved.
  6. *
  7. * License: GPL (version 3 or any later version).
  8. * See LICENSE for details.
  9. * END COPYRIGHT BLOCK **/
  10. #ifdef HAVE_CONFIG_H
  11. # include <config.h>
  12. #endif
  13. /*
  14. FILE : port.c
  15. AUTHOR : Jean-Luc SCHWING
  16. VERSION : 1.0
  17. DATE : 28 November 2000
  18. DESCRIPTION :
  19. This file contains platform-independant version of
  20. common (unix) functions in order to have portable
  21. source code for either unix and windows platforms.
  22. It is greatly inspired from iPlanet DS 5.0 workspace.
  23. LOCAL : None.
  24. HISTORY :
  25. ---------+--------------+------------------------------------------------------
  26. dd/mm/yy | Author | Comments
  27. ---------+--------------+------------------------------------------------------
  28. 28/11/00 | JL Schwing | Creation
  29. ---------+--------------+------------------------------------------------------
  30. 14/03/01 | JL Schwing | 1.2 : Lint cleanup.
  31. ---------+--------------+------------------------------------------------------
  32. */
  33. #include <stdio.h> /* EOF, etc... */
  34. #include <unistd.h> /* sleep(), etc... */ /*JLS 14-03-01*/
  35. #include <pthread.h> /* pthreads(), etc... */
  36. #include "port.h"
  37. /************************************************************************/
  38. /************************************************************************/
  39. /**************** Unix section ***********************/
  40. /************************************************************************/
  41. /************************************************************************/
  42. int
  43. ldclt_mutex_init (
  44. ldclt_mutex_t *mutex)
  45. {
  46. return (pthread_mutex_init (mutex, NULL));
  47. }
  48. int
  49. ldclt_mutex_lock (
  50. ldclt_mutex_t *mutex)
  51. {
  52. return (pthread_mutex_lock (mutex));
  53. }
  54. int
  55. ldclt_mutex_unlock (
  56. ldclt_mutex_t *mutex)
  57. {
  58. return (pthread_mutex_unlock (mutex));
  59. }
  60. void
  61. ldclt_sleep (
  62. int nseconds)
  63. {
  64. sleep (nseconds);
  65. }
  66. int
  67. ldclt_thread_create (
  68. ldclt_tid *tid,
  69. void *(*fct)(void *),
  70. void *param)
  71. {
  72. return (pthread_create (tid, NULL, fct, param));
  73. }