ObjFW  Diff

Differences From Artifact [ed38f771ab]:

To Artifact [7e4b30c2dd]:


13
14
15
16
17
18
19
20

21
22
23
24
25

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66

67
68

69
70
71
72

73
74

75
76
77
78

79
80

81
82
83
84

85
86

87
88
89
90

91
92

93
13
14
15
16
17
18
19

20
21
22
23
24

25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65

66
67

68
69
70
71

72
73

74
75
76
77

78
79

80
81
82
83

84
85

86
87
88
89

90
91

92
93







-
+




-
+







-
+







-
+








-
+







-
+







-
+

-
+



-
+

-
+



-
+

-
+



-
+

-
+



-
+

-
+

 * file.
 */

#include "config.h"

#include <errno.h>

#import "mutex.h"
#import "OFPlainMutex.h"

#include <windows.h>

int
of_mutex_new(of_mutex_t *mutex)
OFPlainMutexNew(OFPlainMutex *mutex)
{
	InitializeCriticalSection(mutex);

	return 0;
}

int
of_mutex_lock(of_mutex_t *mutex)
OFPlainMutexLock(OFPlainMutex *mutex)
{
	EnterCriticalSection(mutex);

	return 0;
}

int
of_mutex_trylock(of_mutex_t *mutex)
OFPlainMutexTryLock(OFPlainMutex *mutex)
{
	if (!TryEnterCriticalSection(mutex))
		return EBUSY;

	return 0;
}

int
of_mutex_unlock(of_mutex_t *mutex)
OFPlainMutexUnlock(OFPlainMutex *mutex)
{
	LeaveCriticalSection(mutex);

	return 0;
}

int
of_mutex_free(of_mutex_t *mutex)
OFPlainMutexFree(OFPlainMutex *mutex)
{
	DeleteCriticalSection(mutex);

	return 0;
}

int
of_rmutex_new(of_rmutex_t *rmutex)
OFPlainRecursiveMutexNew(OFPlainRecursiveMutex *rmutex)
{
	return of_mutex_new(rmutex);
	return OFPlainMutexNew(rmutex);
}

int
of_rmutex_lock(of_rmutex_t *rmutex)
OFPlainRecursiveMutexLock(OFPlainRecursiveMutex *rmutex)
{
	return of_mutex_lock(rmutex);
	return OFPlainMutexLock(rmutex);
}

int
of_rmutex_trylock(of_rmutex_t *rmutex)
OFPlainRecursiveMutexTryLock(OFPlainRecursiveMutex *rmutex)
{
	return of_mutex_trylock(rmutex);
	return OFPlainMutexTryLock(rmutex);
}

int
of_rmutex_unlock(of_rmutex_t *rmutex)
OFPlainRecursiveMutexUnlock(OFPlainRecursiveMutex *rmutex)
{
	return of_mutex_unlock(rmutex);
	return OFPlainMutexUnlock(rmutex);
}

int
of_rmutex_free(of_rmutex_t *rmutex)
OFPlainRecursiveMutexFree(OFPlainRecursiveMutex *rmutex)
{
	return of_mutex_free(rmutex);
	return OFPlainMutexFree(rmutex);
}