本文整理汇总了C++中MessageQueue::PostPrintf方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageQueue::PostPrintf方法的具体用法?C++ MessageQueue::PostPrintf怎么用?C++ MessageQueue::PostPrintf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageQueue
的用法示例。
在下文中一共展示了MessageQueue::PostPrintf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mbf
void * Queue1Thread( void * v )
{
int result = pthread_setname_np( pthread_self(), "FileQueue1" );
if ( result != 0 )
{
LOG( "InitFileQueue: pthread_setname_np failed %s", strerror( result ) );
}
// Process incoming messages until queue is empty
for ( ; ; )
{
Queue1.SleepUntilMessage();
// If Queue3 hasn't finished our last output, sleep until it has.
pthread_mutex_lock( &QueueMutex );
while ( !QueueHasCleared )
{
// Atomically unlock the mutex and block until we get a message.
pthread_cond_wait( &QueueWake, &QueueMutex );
}
pthread_mutex_unlock( &QueueMutex );
const char * msg = Queue1.GetNextMessage();
char commandName[1024] = {};
sscanf( msg, "%s", commandName );
const char * filename = msg + strlen( commandName ) + 1;
MessageQueue * queue = &Queue3;
char const * suffix = strstr( filename, "_nz.jpg" );
if ( suffix != NULL )
{
// cube map
const char * const cubeSuffix[6] = { "_px.jpg", "_nx.jpg", "_py.jpg", "_ny.jpg", "_pz.jpg", "_nz.jpg" };
MemBufferFile mbfs[6] =
{
MemBufferFile( MemBufferFile::NoInit ),
MemBufferFile( MemBufferFile::NoInit ),
MemBufferFile( MemBufferFile::NoInit ),
MemBufferFile( MemBufferFile::NoInit ),
MemBufferFile( MemBufferFile::NoInit ),
MemBufferFile( MemBufferFile::NoInit )
};
char filenameWithoutSuffix[1024];
int suffixStart = suffix - filename;
strcpy( filenameWithoutSuffix, filename );
filenameWithoutSuffix[suffixStart] = '\0';
int side = 0;
for ( ; side < 6; side++ )
{
char sideFilename[1024];
strcpy( sideFilename, filenameWithoutSuffix );
strcat( sideFilename, cubeSuffix[side] );
if ( !mbfs[side].LoadFile( sideFilename ) )
{
if ( !mbfs[ side ].LoadFileFromPackage( sideFilename ) )
{
break;
}
}
LOG( "Queue1 loaded '%s'", sideFilename );
}
if ( side >= 6 )
{
// if no error occured, post to next thread
LOG( "%s.PostPrintf( \"%s %p %i %p %i %p %i %p %i %p %i %p %i\" )", "Queue3", commandName,
mbfs[0].Buffer, mbfs[0].Length,
mbfs[1].Buffer, mbfs[1].Length,
mbfs[2].Buffer, mbfs[2].Length,
mbfs[3].Buffer, mbfs[3].Length,
mbfs[4].Buffer, mbfs[4].Length,
mbfs[5].Buffer, mbfs[5].Length );
queue->PostPrintf( "%s %p %i %p %i %p %i %p %i %p %i %p %i", commandName,
mbfs[0].Buffer, mbfs[0].Length,
mbfs[1].Buffer, mbfs[1].Length,
mbfs[2].Buffer, mbfs[2].Length,
mbfs[3].Buffer, mbfs[3].Length,
mbfs[4].Buffer, mbfs[4].Length,
mbfs[5].Buffer, mbfs[5].Length );
for ( int i = 0; i < 6; ++i )
{
// make sure we do not free the actual buffers because they're used in the next thread
mbfs[i].Buffer = NULL;
mbfs[i].Length = 0;
}
}
else
{
// otherwise free the buffers we did manage to allocate
for ( int i = 0; i < side; ++i )
{
mbfs[i].FreeData();
}
}
}
else
{
//.........这里部分代码省略.........