Skip to contentSkip to conversation

multi threaded file access

DISCUSSION Heinrich du Toit 2 participants 2 messages Dec 6, 2002

lore
Share & tools
lore
#0 lore raw

Hello

I have a tcp/ip server which is offcourse multi threaded :-)

Is it safe to have to threads access the same file descriptor at the same time? Or should I put a mutex over the file descriptor?

Thanks for your help
-Heinrich

#1 lore raw

Hello Heinrich,

Friday, December 6, 2002, 6:39:29 AM, you wrote:

HdT> Hello

HdT> I have a tcp/ip server which is offcourse multi threaded :-)

HdT> Is it safe to have to threads access the same file descriptor at the HdT> same time?
HdT> Or should I put a mutex over the file descriptor?

HdT> Thanks for your help
HdT> -Heinrich

HdT> -
HdT> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in HdT> the body of a message to [email protected]
HdT> More majordomo info at http://vger.kernel.org/majordomo-info.html

Put a mutex over the writing to file descriptor. Depends on how much and what you are writing, it could makes lines combine with each other into a bunch of garbled letters.

Thanks,

Signature · 2 lines
Best regards,
 ruler                            mailto:[email protected]