Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

95
Vistas
File locking a socket?

Is it possible to lock a socket for a thread? For example using flock?

These locks are designed for files, but they take a generic file descriptor as a parameter.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The documentation specifically states that flock is meant for files. From the MacOS documentation page (man): (emphasis added)

Flock() applies or removes an advisory lock on the file associated with the file descriptor fd.

In particular, this is meant for inter-process synchronization on the same file. Assuming that you are trying to lock amongst threads within a process, it seems wise to instead rely on pthread_mutex_lock/unlock. (You are about to do a slow IO, so I woulnd't bother with spinlocks either).

Hope that helps,

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda