title: fcntl not working (doesn't lock the file) in multi-threaded programme
body: <p><a href="https://i.stack.imgur.com/E6lv3.png" rel="nofollow noreferrer">fcntl using code</a></p>
  <p>Hi. I'm trying to access a file with multiple threads,
  trying to get synchronization with record lock(fcntl).</p>
  <p>The problem is, fcntl doesn't lock the file.</p>
  <p><a href="https://i.stack.imgur.com/k33kO.png" rel="nofollow noreferrer">result</a></p>
  <p>I've tried:
  each threads to have own file descriptor/one file descriptor(global),
  checked the parameters of fcntl, but no reason or solution found.</p>
  <p>Is there anything wrong with the function I've write? or maybe something to know when using fcntl in multi-threads?</p>