Modify

Ticket #8915 (closed Bugs: fixed)

Opened 9 months ago

Last modified 9 months ago

boost/log/detail/spin_mutex.hpp: Ignores all failures from pthread_* functions

Reported by: Jeffrey Walton <noloader@…> Owned by: andysem
Milestone: To Be Determined Component: log
Version: Boost 1.54.0 Severity: Problem
Keywords: log spinlock pthread API failure Cc:

Description

boost/log/detail/spin_mutex.hpp ignores all failures from pthread_* functions. Functions include pthread_spin_init, pthread_spin_lock and pthread_spin_unlock.

A lock failure is usually a bad thing, and I can't come up with scenarios where a silent failure is desired. It will make a bad problem worse by corrupting data or terminating the program.

At minimum (as a user), I would expect for Boost to use BOOST_ASSERT with an appropriate exception in debugging and diagnostic builds; and BOOST_VERIFY with an appropriate exception for release or production builds.

boost/thread/pthread/mutex.hpp and boost/interprocess/sync/posix/mutex.hpp are good examples of a mature implementation. They check for failures and throw exceptions where appropriate.

Attachments

Change History

comment:1 Changed 9 months ago by andysem

  • Status changed from new to closed
  • Resolution set to fixed

(In [85199]) Added exceptions in case of errors. Fixes #8915.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.