-#ifndef AFS_PTHREAD_H
-#define AFS_PTHREAD_H
-
/*
- * Copyright (C) 1998 Transarc Corporation. All rights reserved.
- *
+ * Copyright 2000, International Business Machines Corporation and others.
+ * All Rights Reserved.
*
+ * This software has been released under the terms of the IBM Public
+ * License. For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
*/
+#ifndef AFS_PTHREAD_H
+#define AFS_PTHREAD_H
+
#include <windows.h>
#include <time.h>
#include <afs/errmap_nt.h>
typedef int pthread_condattr_t;
typedef int pthread_mutexattr_t;
+typedef int pthread_rwlockattr_t;
typedef int pthread_key_t;
typedef void *pthread_t;
struct rx_queue wait_queue;
HANDLE event;
} cond_waiters_t;
-
+
typedef struct {
CRITICAL_SECTION cs;
struct rx_queue waiting_threads;
} pthread_cond_t;
+typedef struct {
+ pthread_mutex_t write_access_mutex;
+ pthread_mutex_t read_access_completion_mutex;
+ pthread_cond_t read_access_completion_wait;
+ int readers;
+} pthread_rwlock_t;
+
#define PTHREAD_ONCE_INIT {0,1}
extern int pthread_cond_broadcast(pthread_cond_t *cond);
extern int pthread_join(pthread_t target_thread, void **status);
extern int pthread_key_create(pthread_key_t *keyp, void (*destructor)(void *value));
extern int pthread_key_delete(pthread_key_t key);
+
extern int pthread_mutex_destroy(pthread_mutex_t *mp);
extern int pthread_mutex_init(pthread_mutex_t *mp, const pthread_mutexattr_t *attr);
extern int pthread_mutex_lock(pthread_mutex_t *mp);
extern int pthread_mutex_trylock(pthread_mutex_t *mp);
extern int pthread_mutex_unlock(pthread_mutex_t *mp);
+
+extern int pthread_rwlock_destroy(pthread_rwlock_t *rwp);
+extern int pthread_rwlock_init(pthread_rwlock_t *rwp, const pthread_rwlockattr_t *attr);
+extern int pthread_rwlock_rdlock(pthread_rwlock_t *rwp);
+extern int pthread_rwlock_wrlock(pthread_rwlock_t *rwp);
+extern int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwp);
+extern int pthread_rwlock_trywrlock(pthread_rwlock_t *rwp);
+extern int pthread_rwlock_unlock(pthread_rwlock_t *rwp);
+
extern int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
extern int pthread_setspecific(pthread_key_t key, const void *value);
extern pthread_t pthread_self(void);