lock.h 605 B

123456789101112131415161718192021222324
  1. #ifndef CURL_LOCK_H_INCLUDED
  2. #define CURL_LOCK_H_INCLUDED
  3. #include <pthread.h>
  4. typedef struct lock lock;
  5. typedef void lockAcquireFn(lock *);
  6. typedef void lockReleaseFn(lock *);
  7. typedef void lockDestroyFn(lock *);
  8. struct lock {
  9. /* To finish the job of making an abstract lock class that can use locks
  10. other than pthread mutexes, we need to replace 'theLock' with a
  11. "void * implementationP" and make curlLock_create_pthread() malloc
  12. the mutex.
  13. */
  14. pthread_mutex_t theLock;
  15. lockAcquireFn * acquire;
  16. lockReleaseFn * release;
  17. lockDestroyFn * destroy;
  18. };
  19. #endif