Skip to content

Commit cfcaad1

Browse files
committed
[mutex] fix win9x mutex
1 parent 4be5970 commit cfcaad1

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

include/fast_io_core_impl/io_lockable.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ struct basic_general_io_lockable_nonmovable
5252
this->handle = T(::std::forward<Args>(args)...);
5353
}
5454
}
55+
56+
inline constexpr auto native_handle() noexcept(noexcept(handle.native_handle()))
57+
requires(requires() {
58+
handle.native_handle();
59+
})
60+
{
61+
return handle.native_handle();
62+
}
63+
5564
inline constexpr void close() noexcept(noexcept(handle.close()))
5665
{
5766
::fast_io::io_lock_guard guard(mutex);

include/fast_io_device.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ template <::std::integral char_type>
4949
using basic_obuf_file_lockable = basic_io_lockable<basic_obuf_file<char_type>>;
5050
template <::std::integral char_type>
5151
using basic_iobuf_file_lockable = basic_io_lockable<basic_iobuf_file<char_type>>;
52+
53+
template <::std::integral char_type>
54+
using basic_ibuf_file_lockable_nonmovable = basic_io_lockable_nonmovable<basic_ibuf_file<char_type>>;
55+
template <::std::integral char_type>
56+
using basic_obuf_file_lockable_nonmovable = basic_io_lockable_nonmovable<basic_obuf_file<char_type>>;
57+
template <::std::integral char_type>
58+
using basic_iobuf_file_lockable_nonmovable = basic_io_lockable_nonmovable<basic_iobuf_file<char_type>>;
5259
/*
5360
char region
5461
*/
@@ -62,6 +69,10 @@ using ibuf_file_lockable = basic_ibuf_file_lockable<char>;
6269
using obuf_file_lockable = basic_obuf_file_lockable<char>;
6370
using iobuf_file_lockable = basic_iobuf_file_lockable<char>;
6471

72+
using ibuf_file_lockable_nonmovable = basic_ibuf_file_lockable_nonmovable<char>;
73+
using obuf_file_lockable_nonmovable = basic_obuf_file_lockable_nonmovable<char>;
74+
using iobuf_file_lockable_nonmovable = basic_iobuf_file_lockable_nonmovable<char>;
75+
6576
/*
6677
wchar_t region
6778
*/
@@ -79,6 +90,10 @@ using wibuf_file_lockable = basic_ibuf_file_lockable<wchar_t>;
7990
using wobuf_file_lockable = basic_obuf_file_lockable<wchar_t>;
8091
using wiobuf_file_lockable = basic_iobuf_file_lockable<wchar_t>;
8192

93+
using wibuf_file_lockable_nonmovable = basic_ibuf_file_lockable_nonmovable<wchar_t>;
94+
using wobuf_file_lockable_nonmovable = basic_obuf_file_lockable_nonmovable<wchar_t>;
95+
using wiobuf_file_lockable_nonmovable = basic_iobuf_file_lockable_nonmovable<wchar_t>;
96+
8297
/*
8398
char8_t region
8499
*/
@@ -92,6 +107,10 @@ using u8ibuf_file_lockable = basic_ibuf_file_lockable<char8_t>;
92107
using u8obuf_file_lockable = basic_obuf_file_lockable<char8_t>;
93108
using u8iobuf_file_lockable = basic_iobuf_file_lockable<char8_t>;
94109

110+
using u8ibuf_file_lockable_nonmovable = basic_ibuf_file_lockable_nonmovable<char8_t>;
111+
using u8obuf_file_lockable_nonmovable = basic_obuf_file_lockable_nonmovable<char8_t>;
112+
using u8iobuf_file_lockable_nonmovable = basic_iobuf_file_lockable_nonmovable<char8_t>;
113+
95114
/*
96115
char16_t region
97116
*/
@@ -105,6 +124,10 @@ using u16ibuf_file_lockable = basic_ibuf_file_lockable<char16_t>;
105124
using u16obuf_file_lockable = basic_obuf_file_lockable<char16_t>;
106125
using u16iobuf_file_lockable = basic_iobuf_file_lockable<char16_t>;
107126

127+
using u16ibuf_file_lockable_nonmovable = basic_ibuf_file_lockable_nonmovable<char16_t>;
128+
using u16obuf_file_lockable_nonmovable = basic_obuf_file_lockable_nonmovable<char16_t>;
129+
using u16iobuf_file_lockable_nonmovable = basic_iobuf_file_lockable_nonmovable<char16_t>;
130+
108131
/*
109132
char32_t region
110133
*/
@@ -118,6 +141,10 @@ using u32ibuf_file_lockable = basic_ibuf_file_lockable<char32_t>;
118141
using u32obuf_file_lockable = basic_obuf_file_lockable<char32_t>;
119142
using u32iobuf_file_lockable = basic_iobuf_file_lockable<char32_t>;
120143

144+
using u32ibuf_file_lockable_nonmovable = basic_ibuf_file_lockable_nonmovable<char32_t>;
145+
using u32obuf_file_lockable_nonmovable = basic_obuf_file_lockable_nonmovable<char32_t>;
146+
using u32iobuf_file_lockable_nonmovable = basic_iobuf_file_lockable_nonmovable<char32_t>;
147+
121148
#if defined(_WIN32) || (__has_include(<sys/socket.h>) && __has_include(<netinet/in.h>) && !defined(__wasi__))
122149

123150
template <::std::integral char_type>

include/fast_io_hosted/threads/mutex/impl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ using native_mutex =
2424
mcf_gthread_mutex
2525
#elif (defined(_WIN32) && !defined(__WINE__)) || defined(__CYGWIN__)
2626
#if !defined(__CYGWIN__) && !defined(__BIONIC__) && defined(_WIN32_WINDOWS)
27-
#if (!defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0600)
28-
win32_srwlock
29-
#else
3027
win32_critical_section
31-
#endif
3228
#else
3329
#if (!defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0600)
3430
rtl_srwlock

0 commit comments

Comments
 (0)