mirror of
https://github.com/janet-lang/janet
synced 2024-12-27 00:40:26 +00:00
Avoid including windows.h in janet.h for JanetOSMutex.
This commit is contained in:
parent
8cd57025a0
commit
bf9b6b1301
@ -2,6 +2,8 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unlreleased - ???
|
## Unlreleased - ???
|
||||||
|
- Fix some marshalling bugs.
|
||||||
|
- Add optional Makefile target to install jpm as well.
|
||||||
- Supervisor channels in threads will no longer include a wastful copy of the fiber in every
|
- Supervisor channels in threads will no longer include a wastful copy of the fiber in every
|
||||||
message across a thread.
|
message across a thread.
|
||||||
- Allow passing a closure to `ev/thead` as well as a whole fiber.
|
- Allow passing a closure to `ev/thead` as well as a whole fiber.
|
||||||
|
@ -94,19 +94,19 @@ static int32_t janet_decref(JanetAbstractHead *ab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void janet_os_mutex_init(JanetOSMutex *mutex) {
|
void janet_os_mutex_init(JanetOSMutex *mutex) {
|
||||||
InitializeCriticalSection(mutex);
|
InitializeCriticalSection((CRITICAL_SECTION *) mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void janet_os_mutex_deinit(JanetOSMutex *mutex) {
|
void janet_os_mutex_deinit(JanetOSMutex *mutex) {
|
||||||
DeleteCriticalSection(mutex);
|
DeleteCriticalSection((CRITICAL_SECTION *) mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void janet_os_mutex_lock(JanetOSMutex *mutex) {
|
void janet_os_mutex_lock(JanetOSMutex *mutex) {
|
||||||
EnterCriticalSection(mutex);
|
EnterCriticalSection((CRITICAL_SECTION *) mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void janet_os_mutex_unlock(JanetOSMutex *mutex) {
|
void janet_os_mutex_unlock(JanetOSMutex *mutex) {
|
||||||
LeaveCriticalSection(mutex);
|
LeaveCriticalSection((CRITICAL_SECTION *) mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -330,11 +330,16 @@ typedef struct {
|
|||||||
/* Some extra includes if EV is enabled */
|
/* Some extra includes if EV is enabled */
|
||||||
#ifdef JANET_EV
|
#ifdef JANET_EV
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
#ifdef JANET_NET
|
typedef struct JanetDudCriticalSection {
|
||||||
#include <winsock2.h>
|
/* Avoid including windows.h here - instead, create a structure of the same size */
|
||||||
#endif
|
/* Needs to be same size as crtical section see WinNT.h for CRITCIAL_SECTION definition */
|
||||||
#include <windows.h>
|
void *debug_info;
|
||||||
typedef CRITICAL_SECTION JanetOSMutex;
|
long lock_count
|
||||||
|
long recursion_count;
|
||||||
|
void *owning_thread;
|
||||||
|
void *lock_semaphore;
|
||||||
|
unsigned long spin_count;
|
||||||
|
} JanetOSMutex;
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
typedef pthread_mutex_t JanetOSMutex;
|
typedef pthread_mutex_t JanetOSMutex;
|
||||||
|
Loading…
Reference in New Issue
Block a user