Thread: syslog calls and threading

  1. #1
    Registered User
    Join Date
    Aug 2002

    syslog calls and threading

    Hi All,

    To ensure thread-safety of syslog(3) calls with pthread child threads, should I make a fresh openlog(3) call? I've had weird hangs with syslog calls on my red hat system and I don't have syslog_r available on my system.

    I guess I just want to know if it's safe to call syslog with child threads or not There's not much concrete info out there

    Thanks, rotis23

  2. #2
    Join Date
    Nov 2003
    My version of the man page 3 thread_safety lists syslog() as not cancellation safe or asynch signal safe. It's not atomic, in other words.

    You're better off handling those types of calls by blocking all blockable signals when the call is active. We don't call syslog() with child threads, but I personally don't know if it's safe or not. Here is another opinion on another platform:

  3. #3
    Registered User
    Join Date
    Aug 2002
    Thanks Jim.

    It seems pretty obvious to me that syslog is not safe on my redhat system.

    I need syslog_r.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WinAPI & threading
    By @nthony in forum Windows Programming
    Replies: 17
    Last Post: 10-15-2007, 04:41 PM
  2. Problem with threading
    By osal in forum Windows Programming
    Replies: 6
    Last Post: 07-21-2004, 12:41 PM
  3. Clipboard Threading Error
    By ginoitalo in forum C# Programming
    Replies: 5
    Last Post: 06-13-2002, 05:17 PM