is possible lock socket thread? example using flock?
these locks designed files, take generic file descriptor parameter.
the documentation states flock meant files. macos documentation page (man): (emphasis added)
flock() applies or removes advisory lock on file associated file descriptor fd.
in particular, meant inter-process synchronization on same file. assuming trying lock amongst threads within process, seems wise instead rely on pthread_mutex_lock/unlock. (you slow io, woulnd't bother spinlocks either).
hope helps,
Comments
Post a Comment