cvra / platform-abstraction

Platform abstraction layer for microcontrollers
3 stars 6 forks source link

Semaphore operations naming #37

Closed msplr closed 10 years ago

msplr commented 10 years ago

Are take and release really the right names for semaphore operations? What about something like pend or wait instead of take and signal or post instead release? In my eyes it looks strange to use os_semaphore_release() to wake a blocking thread, since release rather reminds me of a lock and not a signaling method. What do you think?

antoinealb commented 10 years ago

I already got biten by that, so I vote for a naming change. My vote goes to pend and signal.

msplr commented 10 years ago

+1 for pend and signal

pierluca commented 10 years ago

From a linguistic point of view, I'd prefer wait to pend. Pend gives the idea of indecision, unlike wait.

antoinealb commented 10 years ago

So pend is more appropriate as you don't know if the semaphore will be signaled.

pierluca commented 10 years ago

Not really.

pend

  1. to await judgment or settlement
  2. to hang; depend or
  3. to remain undecided or unsettled.

It's not indecision as in "Waiting for Godot" but rather indecision as "who knows what will happen to this".

On the other hand:

wait a. To remain or rest in expectation b. To tarry until another catches up.

31415us commented 10 years ago

since semaphores are just somewhat glorified counters what about inc and dec?

antoinealb commented 10 years ago

P & V #troll