Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrency fprintf #681

Closed
logslie opened this issue Jun 22, 2016 · 3 comments
Closed

Concurrency fprintf #681

logslie opened this issue Jun 22, 2016 · 3 comments

Comments

@logslie
Copy link

logslie commented Jun 22, 2016

Hi,

I'm developing a new module that writes logs in a log file using the function fprintf.
My question is, do I have to implement any lock to write safely in the file? As far as I know fprintf is thread-safe, but even though it, I don't know if it is necessary or not.

Thanks,

Laura

@miconda
Copy link
Member

miconda commented Jun 22, 2016

You need to synchronise when writing to same file from many processes. Among options:

    1. lock a mutex; open file; append message; close file; unlock mutex
    1. each process writes to pipe and a dedicated process reads from the pipe and writes to the file

@miconda
Copy link
Member

miconda commented Jun 23, 2016

I am closing this issue -- we use the tracker on github for bugs or new feature requests. If you want to discuss more on this topic, use the mailing lists (e.g., sr-users at lists dot sip-router dot org).

@miconda miconda closed this as completed Jun 23, 2016
@logslie
Copy link
Author

logslie commented Jun 23, 2016

Thank you Daniel.

Laura García Pérez
www.logslie.com http://www.logslie.com/
+34680923532
+12602069698

On 23 Jun 2016, at 08:15, Daniel-Constantin Mierla notifications@github.com wrote:

Closed #681 #681.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #681 (comment), or mute the thread https://github.com/notifications/unsubscribe/AEpXvX3BJa-b88fceCBev3CpvHCciIFvks5qOiR3gaJpZM4I7mj_.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants