Blame src/win32/thread.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
#ifndef INCLUDE_win32_thread_h__
Packit Service 20376f
#define INCLUDE_win32_thread_h__
Packit Service 20376f
Packit Service 20376f
#include "../common.h"
Packit Service 20376f
Packit Service 20376f
#if defined (_MSC_VER)
Packit Service 20376f
#	define GIT_RESTRICT __restrict
Packit Service 20376f
#else
Packit Service 20376f
#	define GIT_RESTRICT __restrict__
Packit Service 20376f
#endif
Packit Service 20376f
Packit Service 20376f
typedef struct {
Packit Service 20376f
	HANDLE thread;
Packit Service 20376f
	void *(*proc)(void *);
Packit Service 20376f
	void *param;
Packit Service 20376f
	void *result;
Packit Service 20376f
} git_thread;
Packit Service 20376f
Packit Service 20376f
typedef CRITICAL_SECTION git_mutex;
Packit Service 20376f
typedef HANDLE git_cond;
Packit Service 20376f
Packit Service 20376f
typedef struct { void *Ptr; } GIT_SRWLOCK;
Packit Service 20376f
Packit Service 20376f
typedef struct {
Packit Service 20376f
	union {
Packit Service 20376f
		GIT_SRWLOCK srwl;
Packit Service 20376f
		CRITICAL_SECTION csec;
Packit Service 20376f
	} native;
Packit Service 20376f
} git_rwlock;
Packit Service 20376f
Packit Service 20376f
int git_threads_init(void);
Packit Service 20376f
Packit Service 20376f
int git_thread_create(git_thread *GIT_RESTRICT,
Packit Service 20376f
	void *(*) (void *),
Packit Service 20376f
	void *GIT_RESTRICT);
Packit Service 20376f
int git_thread_join(git_thread *, void **);
Packit Service 20376f
size_t git_thread_currentid(void);
Packit Service 20376f
void git_thread_exit(void *);
Packit Service 20376f
Packit Service 20376f
int git_mutex_init(git_mutex *GIT_RESTRICT mutex);
Packit Service 20376f
int git_mutex_free(git_mutex *);
Packit Service 20376f
int git_mutex_lock(git_mutex *);
Packit Service 20376f
int git_mutex_unlock(git_mutex *);
Packit Service 20376f
Packit Service 20376f
int git_cond_init(git_cond *);
Packit Service 20376f
int git_cond_free(git_cond *);
Packit Service 20376f
int git_cond_wait(git_cond *, git_mutex *);
Packit Service 20376f
int git_cond_signal(git_cond *);
Packit Service 20376f
Packit Service 20376f
int git_rwlock_init(git_rwlock *GIT_RESTRICT lock);
Packit Service 20376f
int git_rwlock_rdlock(git_rwlock *);
Packit Service 20376f
int git_rwlock_rdunlock(git_rwlock *);
Packit Service 20376f
int git_rwlock_wrlock(git_rwlock *);
Packit Service 20376f
int git_rwlock_wrunlock(git_rwlock *);
Packit Service 20376f
int git_rwlock_free(git_rwlock *);
Packit Service 20376f
Packit Service 20376f
#endif /* INCLUDE_win32_thread_h__ */