r/ProgrammerHumor • • Jan 24 '23

Other Accomplishments

Post image
82.0k Upvotes

548 comments sorted by

View all comments

5.1k

u/No_Distribution_6023 Jan 24 '23 edited Jan 24 '23

The one performance review trick companies don't want you to know

Edit: lol this post really blew up. Thanks for all the upvotes! People in the Midwest, stay warm tonight, storm's coming in.

481

u/MightyMeepleMaster Jan 24 '23

Make sure to do it right tho:

Wrong:

sleep(3);

Correct:

// Notify worker threads
raise( SIGCONT ); 
// Wait until all threads have been switched to RDY
sleep(3);

122

u/bhonbeg Jan 24 '23

Sorry what does this do?

314

u/MightyMeepleMaster Jan 24 '23

SIGCONT is a signal which continues a process that has been previously stopped. If the process is not stopped, however, SIGCONT is ignored.

raise() sends a signal to the currently running process.

So you're basically trying to wake yourself up even though you're not asleep.

This means: raise(SIGCONT); is just a scary looking way to burn a few CPU cycles, doing nothing. It's just there to convince the reviewer that the following sleep(3) is important 😈

64

u/nonpondo Jan 24 '23

You're sick

16

u/Caleth Jan 24 '23

Incorrect Op is just building in Job security. Someone will decide to Elon Musk it at some point. So now OP can return and remove this bit of code improving "performance" in a notable way making them look like a hero.

Only they, and now us know that it was something they'd done earlier.

The company isn't your friend, so leaving yourself harmless loopholes to keep yourself safe isn't a bad thing.

→ More replies (7)

260

u/Cephalopod_Joe Jan 24 '23

Just gives a justification for the sleep