Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » serializing Log_write()/System_printf() calls across threads
serializing Log_write()/System_printf() calls across threads [message #1603] Mon, 09 March 2009 19:00 Go to next message
Chris Ring is currently offline Chris RingFriend
Messages: 16
Registered: July 2009
Location: Santa Barbara, CA
Junior Member
I have a product with Linux-side tracing which formats the strings on the
host and [optionally] sends it to stdout. It also has a [conditional]
thread-safe lock that ensures trace strings aren't corrupted/pre-empted by
higher priority threads which also perform tracing.

Looking here at xdc.runtime.Log...
http://rtsc.eclipse.org/docs-tip/Using_xdc.runtime_Logging

... I think we'll need the same functionality, but I don't understand the
details. Will Log calls serialize access to the configured Logger
(LoggerSys?) - which will then format and printf() the results? Or will
LoggerSys serialize the System_printf() calls? Or will System_printf()
serialize the printf() calls? Or...?

I guess I'm just asking how to configure Log/System to format and render
on the embedded device in a thread-serialized way.

Thanks.

Chris
Re: serializing Log_write()/System_printf() calls across threads [message #1683 is a reply to message #1603] Mon, 16 March 2009 15:12 Go to previous message
Dave Russo is currently offline Dave RussoFriend
Messages: 172
Registered: July 2009
Senior Member
Chris Ring wrote:
> I have a product with Linux-side tracing which formats the strings on
> the host and [optionally] sends it to stdout. It also has a
> [conditional] thread-safe lock that ensures trace strings aren't
> corrupted/pre-empted by higher priority threads which also perform tracing.
>
> Looking here at xdc.runtime.Log...
> http://rtsc.eclipse.org/docs-tip/Using_xdc.runtime_Logging
>
> ... I think we'll need the same functionality, but I don't understand
> the details. Will Log calls serialize access to the configured Logger
> (LoggerSys?) - which will then format and printf() the results? Or will
> LoggerSys serialize the System_printf() calls? Or will System_printf()
> serialize the printf() calls? Or...?
>
LoggerSys and System_printf do not put any locks around their output
operations. The only locking done by xdc.runtime is around _very_ small
regions that update its internal global data.

The only lock used by xdc.runtime is the "system lock" which is assumed
to be very efficient but does not allow any preemption while the lock is
held. It is often implemented by globally disabling interrupts. You
probably _don't_ want to use this lock to serialize log events.

> I guess I'm just asking how to configure Log/System to format and render
> on the embedded device in a thread-serialized way.
>
You can create a "stacking" logger that acquires a lock appropriate for
your OS calls the underlying loggers and releases the lock after this
logger returns. An example of such a logger is here:
http://rtsc.eclipse.org/docs-tip/Extending_xdc.runtime_Loggi ng/Example_1


Alternatively, you can simply create a logger that does the locking
around calls to Log_doPrint()
( http://rtsc.eclipse.org/cdoc-tip/index.html#xdc/runtime/Log. html#do.Print)


> Thanks.
>
> Chris
>
Previous Topic:How to use @opts-file with xs command
Next Topic:ISemaphore.getCount
Goto Forum:
  


Current Time: Wed Apr 24 20:13:36 GMT 2024

Powered by FUDForum. Page generated in 0.03024 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top