Changed return tipe of linked_remove to short to avoid including stdint.
Added lock to the list to make it pthread-safe.