Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7491515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:04:07+00:00 2026-05-29T16:04:07+00:00

I have a common getter method with rdlock and unlock: e_state get_state ( )

  • 0

I have a common getter method with rdlock and unlock:

e_state get_state   ( )
{
    rdlock();
    e_state state= m_e_state;
    unlock();
    return state;
}

The setter with writelock and unlock:

void set_state (e_state a_new_e_state)  
{
    wrlock();
    m_e_state = a_new_e_state;
    unlock();
}

The rdlock(), wrlock() and unlock() methods are the followings:

bool rdlock ( ){return pthread_rwlock_rdlock (&m_rwlock) == 0;}
bool wrlock ( ){return pthread_rwlock_wrlock (&m_rwlock) == 0;}
bool unlock ( ){return pthread_rwlock_unlock (&m_rwlock) == 0;}

With Valgrind I got the following errors:

Conflicting load by thread 3 at 0x04328fa0 size 4
==16557==    at 0x8068712: Sample_Namespace::get_state() (CClassManagerXY.h:94)
==16557==    by 0x807FA9B: Sample_Namespace::xy_method(std::string const&,                          Sample_Namespace::IClassX&, int) (IClassY.cpp:773)
==16557==    by 0x48CC8CA: Sources::SourceClassX::run() (SourceClassX.cpp:156)
==16557==    by 0x8065BEF: run(void*) (CClassManagerXY.cpp:120)
==16557==    by 0x402A31B: ??? (in /usr/lib/valgrind/vgpreload_drd-x86-linux.so)
==16557==    by 0x4062B24: start_thread (in /lib/libpthread-2.11.2.so)
==16557==    by 0x428446D: clone (in /lib/libc-2.11.2.so)
==16557== Address 0x4328fa0 is at offset 8 from 0x4328f98. Allocation context:
==16557==    at 0x4029BD3: operator new(unsigned int) (in       /usr/lib/valgrind/vgpreload_drd-x86-linux.so)
==16557==    by 0x807E9FD: Sample_Namespace::loads(std::string const&, bool)    (CClassY.cpp:460)
==16557==    by 0x807EE9A: Sample_Namespace::load() (CClassY.cpp:542)
==16557==    by 0x807D7D4: Sample_Namespace::init() (CClassY.cpp:171)
==16557==    by 0x808D57C: main (main.cpp:203)
==16557== Other segment start (thread 2)
==16557==    at 0x4284458: clone (in /lib/libc-2.11.2.so)
==16557== Other segment end (thread 2)
==16557==    at 0x42925E6: __lll_unlock_wake_private (in /lib/libc-2.11.2.so)
==16557==    by 0x41F45DD: _L_unlock_13308 (in /lib/libc-2.11.2.so)
==16557==    by 0x41F4527: buffered_vfprintf (in /lib/libc-2.11.2.so)
==16557==    by 0x41EF2FA: vfprintf (in /lib/libc-2.11.2.so)
==16557==    by 0x41F9BAE: fprintf (in /lib/libc-2.11.2.so)
==16557==    by 0x40395F7: Sample_Namespace::write_trace_record(int, unsigned int, char const*, int, char const*, char const*, ...) (CTrace.cpp:106)
==16557==    by 0x8065C84: run_adapter(void*) (CClassManagerXY.cpp:124)
==16557==    by 0x402A31B: ??? (in /usr/lib/valgrind/vgpreload_drd-x86-linux.so)
==16557==    by 0x4062B24: start_thread (in /lib/libpthread-2.11.2.so)
==16557==    by 0x428446D: clone (in /lib/libc-2.11.2.so)

I don’t know why can Data Race be near the state variable, I managed there the locks. I dont understand well what is the meaning of the “Address is at offset 8 from…” row. Have you got any tip what is the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:04:08+00:00Added an answer on May 29, 2026 at 4:04 pm

    Thank You PlasmaHH!
    I have found there are one more method use the variable. It was my mistake.
    However I don’t understand well, is conflicting load really dangerous? Not only conflicting store?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unless I am thoroughly mistaken, the getter/setter pattern is a common pattern used for
I have common functionality that I need to access from all screens of my
I want to create templates for base new reports on to have common designs.
We have several common libs. Ideally we want them all to use the latest
i have several common elements (components), that will generate some html. it seems my
We have a common problem of moving our development SQL 2005 database onto shared
I have a common code of serializing a class object in my 3-4 methods
I have a common comms library that i have written to communicate with our
I have a common script which Im including in my PHPcron files and the
I have a common resource, which I want 1 and only 1 instance of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.