initial commit
This commit is contained in:
38
3rd_party/glue/pthread.h
vendored
Normal file
38
3rd_party/glue/pthread.h
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef REPERTORY_PTHREAD_H
|
||||
#define REPERTORY_PTHREAD_H
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#define pthread_mutex_t std::mutex *
|
||||
#define pthread_cond_t std::condition_variable *
|
||||
|
||||
static void pthread_mutex_init(pthread_mutex_t *mtx, void *) { *mtx = new std::mutex(); }
|
||||
|
||||
static void pthread_mutex_destroy(pthread_mutex_t *mtx) {
|
||||
delete *mtx;
|
||||
*mtx = nullptr;
|
||||
}
|
||||
|
||||
static void pthread_mutex_lock(pthread_mutex_t *mtx) { (*mtx)->lock(); }
|
||||
|
||||
static void pthread_mutex_unlock(pthread_mutex_t *mtx) { (*mtx)->unlock(); }
|
||||
|
||||
static void pthread_cond_init(pthread_cond_t *cond, void *) {
|
||||
*cond = new std::condition_variable();
|
||||
}
|
||||
|
||||
static void pthread_cond_destroy(pthread_cond_t *cond) {
|
||||
delete *cond;
|
||||
*cond = nullptr;
|
||||
}
|
||||
|
||||
static void pthread_cond_signal(pthread_cond_t *cond) { (*cond)->notify_one(); }
|
||||
|
||||
static void pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mtx) {
|
||||
std::unique_lock<std::mutex> l(**mtx);
|
||||
(*cond)->wait(l);
|
||||
}
|
||||
#endif // _WIN32
|
||||
#endif // REPERTORY_PTHREAD_H
|
9
3rd_party/glue/strings.h
vendored
Normal file
9
3rd_party/glue/strings.h
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef REPERTORY_STRINGS_H
|
||||
#define REPERTORY_STRINGS_H
|
||||
#ifdef _WIN32
|
||||
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // REPERTORY_STRINGS_H
|
6
3rd_party/glue/sys/socket.h
vendored
Normal file
6
3rd_party/glue/sys/socket.h
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef REPERTORY_SOCKET_H
|
||||
#define REPERTORY_SOCKET_H
|
||||
#ifdef _WIN32
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // REPERTORY_SOCKET_H
|
8
3rd_party/glue/sys/time.h
vendored
Normal file
8
3rd_party/glue/sys/time.h
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef REPERTORY_TIME_H
|
||||
#define REPERTORY_TIME_H
|
||||
#ifdef _WIN32
|
||||
|
||||
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // REPERTORY_TIME_H
|
8
3rd_party/glue/unistd.h
vendored
Normal file
8
3rd_party/glue/unistd.h
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef REPERTORY_UNISTD_H
|
||||
#define REPERTORY_UNISTD_H
|
||||
#ifdef _WIN32
|
||||
|
||||
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // REPERTORY_UNISTD_H
|
Reference in New Issue
Block a user