mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 21:08:56 +00:00
Merge pull request #2460 from libgit2/cmn/sched-yield
Move yield to the tests and enable for FreeBSD
This commit is contained in:
commit
b0ed61f822
@ -53,12 +53,6 @@ typedef struct {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GIT_WIN32)
|
|
||||||
#define git_thread_yield() Sleep(0)
|
|
||||||
#else
|
|
||||||
#define git_thread_yield() sched_yield()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Pthreads Mutex */
|
/* Pthreads Mutex */
|
||||||
#define git_mutex pthread_mutex_t
|
#define git_mutex pthread_mutex_t
|
||||||
#define git_mutex_init(a) pthread_mutex_init(a, NULL)
|
#define git_mutex_init(a) pthread_mutex_init(a, NULL)
|
||||||
@ -186,7 +180,6 @@ GIT_INLINE(int64_t) git_atomic64_add(git_atomic64 *a, int64_t addend)
|
|||||||
#define git_thread unsigned int
|
#define git_thread unsigned int
|
||||||
#define git_thread_create(thread, attr, start_routine, arg) 0
|
#define git_thread_create(thread, attr, start_routine, arg) 0
|
||||||
#define git_thread_join(id, status) (void)0
|
#define git_thread_join(id, status) (void)0
|
||||||
#define git_thread_yield() (void)0
|
|
||||||
|
|
||||||
/* Pthreads Mutex */
|
/* Pthreads Mutex */
|
||||||
#define git_mutex unsigned int
|
#define git_mutex unsigned int
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
#include "clar_libgit2.h"
|
#include "clar_libgit2.h"
|
||||||
#include "thread_helpers.h"
|
#include "thread_helpers.h"
|
||||||
|
|
||||||
|
#ifdef GIT_THREADS
|
||||||
|
|
||||||
|
# if defined(GIT_WIN32)
|
||||||
|
# define git_thread_yield() Sleep(0)
|
||||||
|
# elif defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__DragonFly__)
|
||||||
|
# define git_thread_yield() pthread_yield()
|
||||||
|
# else
|
||||||
|
# define git_thread_yield() sched_yield()
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
# define git_thread_yield() (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
static git_repository *_repo;
|
static git_repository *_repo;
|
||||||
static git_tree *_a, *_b;
|
static git_tree *_a, *_b;
|
||||||
static git_atomic _counts[4];
|
static git_atomic _counts[4];
|
||||||
|
Loading…
Reference in New Issue
Block a user