This is a general question.

I am familiar with accessors and mutators (getters and setters). I have now been reading up on semaphores. I am having trouble finding out differences between them/how they are related. Can anyone help me out with an explaination or a link? Thanks.

P.S. - sorry if this is not the correct forum

The main difference between semaphores and accessors/mutators is that semaphores are for signaling some state between threads, which might prohibit the use of accessor/mutator at a given moment in time. A Google search will turn up lots of good links that explain the thread control issue using semaphores, mutex, or other methods. A textbook on operating systems is usually another good source.

In other words, accessors/mutators and semaphores are absolutely different beasts. Accessors and mutators are member functions. Semaphores are objects with special sets of operations and values. In generally semaphores are rather types and accessors/mutators are essentially operations.

So the question looks like what's a difference between door-handles and padlocks? ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.