Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:rhabacker:branches:windows:mingw:win64
mingw64-boost
boost-interprocess_file_lock_wchar.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File boost-interprocess_file_lock_wchar.patch of Package mingw64-boost
diff --git a/boost/interprocess/detail/os_file_functions.hpp b/boost/interprocess/detail/os_file_functions.hpp index 0bc9744..7a8399c 100644 --- a/boost/interprocess/detail/os_file_functions.hpp +++ b/boost/interprocess/detail/os_file_functions.hpp @@ -124,6 +124,14 @@ inline file_handle_t open_existing_file (name, (unsigned int)mode, winapi::open_existing, attr, 0); } +inline file_handle_t open_existing_file +(const wchar_t *name, mode_t mode, bool temporary = false) +{ + unsigned long attr = temporary ? winapi::file_attribute_temporary : 0; + return winapi::create_file + (name, (unsigned int)mode, winapi::open_existing, attr, 0); +} + inline bool delete_file(const char *name) { return winapi::unlink_file(name); } diff --git a/boost/interprocess/detail/win32_api.hpp b/boost/interprocess/detail/win32_api.hpp index 4bffb51..a87483e 100644 --- a/boost/interprocess/detail/win32_api.hpp +++ b/boost/interprocess/detail/win32_api.hpp @@ -911,6 +911,7 @@ extern "C" __declspec(dllimport) void * __stdcall CreateFileMappingA (void *, in extern "C" __declspec(dllimport) void * __stdcall MapViewOfFileEx (void *, unsigned long, unsigned long, unsigned long, std::size_t, void*); extern "C" __declspec(dllimport) void * __stdcall OpenFileMappingA (unsigned long, int, const char *); extern "C" __declspec(dllimport) void * __stdcall CreateFileA (const char *, unsigned long, unsigned long, struct interprocess_security_attributes*, unsigned long, unsigned long, void *); +extern "C" __declspec(dllimport) void * __stdcall CreateFileW (const wchar_t *, unsigned long, unsigned long, struct interprocess_security_attributes*, unsigned long, unsigned long, void *); extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); extern "C" __declspec(dllimport) int __stdcall FlushViewOfFile (void *, std::size_t); extern "C" __declspec(dllimport) int __stdcall VirtualUnlock (void *, std::size_t); @@ -1179,6 +1180,24 @@ inline void *create_file(const char *name, unsigned long access, unsigned long c return invalid_handle_value; } +inline void *create_file(const wchar_t *name, unsigned long access, unsigned long creation_flags, unsigned long attributes, interprocess_security_attributes *psec) +{ + for (unsigned int attempt(0); attempt < error_sharing_violation_tries; ++attempt) { + void * const handle = CreateFileW(name, access, + file_share_read | file_share_write | file_share_delete, + psec, creation_flags, attributes, 0); + bool const invalid(invalid_handle_value == handle); + if (!invalid) { + return handle; + } + if (error_sharing_violation != get_last_error()) { + return handle; + } + sleep(error_sharing_violation_sleep_ms); + } + return invalid_handle_value; +} + inline void get_system_info(system_info *info) { GetSystemInfo(info); } diff --git a/boost/interprocess/sync/file_lock.hpp b/boost/interprocess/sync/file_lock.hpp index ef1c68a..f7a1520 100644 --- a/boost/interprocess/sync/file_lock.hpp +++ b/boost/interprocess/sync/file_lock.hpp @@ -52,6 +52,7 @@ class file_lock //!Opens a file lock. Throws interprocess_exception if the file does not //!exist or there are no operating system resources. file_lock(const char *name); + file_lock(const wchar_t *name); //!Moves the ownership of "moved"'s file mapping object to *this. //!After the call, "moved" does not represent any file mapping object. @@ -209,6 +210,16 @@ inline file_lock::file_lock(const char *name) } } +inline file_lock::file_lock(const wchar_t *name) +{ + m_file_hnd = ipcdetail::open_existing_file(name, read_write); + + if (m_file_hnd == ipcdetail::invalid_file()) { + error_info err(system_error_code()); + throw interprocess_exception(err); + } +} + inline file_lock::~file_lock() { if(m_file_hnd != ipcdetail::invalid_file()){
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor