On 5/30/22 14:37, Adriano dos Santos Fernandes wrote:
Hi!

Isn't this thread unsafe?

struct event_t
{
        SLONG event_count;
        int pid;
        pthread_mutex_t event_mutex[1];
        pthread_cond_t event_cond[1];
};

int SharedMemoryBase::eventPost(event_t* event)
{
        ...
        ++event->event_count;
        ...
}

Should not event_count use a std::atomic?

Or is SharedMemoryBase::eventPost expected to not be thread safe to be
called concurrently?

It's always called with shared memory mutex taken, i.e. no concurrency problems.




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to