chsnprintf thread safe
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: chsnprintf thread safe
Hi,
It is meant to be thread safe IF the stream is thread safe as well.
Giovanni
It is meant to be thread safe IF the stream is thread safe as well.
Giovanni
Re: chsnprintf thread safe
Hi
this is what ive got
debugOut is called everywhere all over the application/different threads to spit out debug messages.
But i also use chsnprintf alot to format other things, these normally use static buffers declared in each software module.
both debug and chsnprintf use chvprintf the differential is the stream.
this is what ive got
Code: Select all
#define DBGIO &SD6
void debugInit( void )
{
sdStart( DBGIO, &debugconfig );
stream = (BaseSequentialStream *)DBGIO;
}
void debugOut( uint32_t mask, const char *fmt, ... )
{
va_list args;
if( stream != NULL )
{
va_start( args, fmt );
chvprintf( stream, fmt, args );
va_end( args );
}
}
debugOut is called everywhere all over the application/different threads to spit out debug messages.
But i also use chsnprintf alot to format other things, these normally use static buffers declared in each software module.
both debug and chsnprintf use chvprintf the differential is the stream.