Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9285 closed Bugs (fixed)

CreateMutex return NULL if failed

Reported by: huyuguang@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

winapi_mutex_wrapper.hpp line 149

The invalid handle for mutex is NULL(0), not winapi::invalid_handle_value(-1).

Change History (5)

comment:1 by Ion Gaztañaga, 9 years ago

Thanks for the report. It will changed to handle a nullptr. winapi_mutex_wrapper also shares the same bug described in your #9288 ("timed_wait does not check if has expired") ticket.

comment:2 by Ion Gaztañaga, 9 years ago

Resolution: fixed
Status: newclosed

(In [86476]) Fixes #9285

in reply to:  1 comment:3 by huyuguang@…, 9 years ago

Replying to igaztanaga:

Thanks for the report. It will changed to handle a nullptr. winapi_mutex_wrapper also shares the same bug described in your #9288 ("timed_wait does not check if has expired") ticket.

I suggest you remove the #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION in workaround.hpp

#if defined(_WIN32)
defined(WIN32) defined(WIN32)

#define BOOST_INTERPROCESS_WINDOWS #define BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME

If a server need to handle multiple message queue, for example, 64 queues, the spinlock would kill too much cpu. Also, if possible, I hope you can implement two more function which are multi_timed_recv and multi_timed_send, so that I can wait multiple queue and do not need to lanuch many threads for every queues.

comment:4 by Ion Gaztañaga, 9 years ago

Native synchronization primitives are experimental so they are not enabled by default. spinlock handling will be improved in Boost 1.55 so CPU usage will be pretty low.

in reply to:  4 comment:5 by anonymous, 9 years ago

Replying to igaztanaga:

Native synchronization primitives are experimental so they are not enabled by default. spinlock handling will be improved in Boost 1.55 so CPU usage will be pretty low.

I just checked the latest code boost 1.55 beta, now the spinlock use _mm_pause. Maybe it will be better, but I really really want you implement a actor based message queue. I hope I can write the code as async_recv(queue, buffer_ptr, [buffer_ptr](size_t cb) {}), and I can handle multiple queues's recv and send in one thread.

Note: See TracTickets for help on using tickets.