On 02/12/2015 12:06 AM, Tapani Pälli wrote: > > > On 02/12/2015 03:47 AM, Chad Versace wrote: >> On 02/09/2015 06:22 AM, Tapani Pälli wrote:
>>> +// Thread takes care that we do not issue another buffer
>>> +// swap before previous swap has completed.
>>> +class NaclSwapThread : public pp::SimpleThread
>>> +{
>>> +public:
>>> + explicit NaclSwapThread(const pp::InstanceHandle &instance,
>>> + pp::Graphics3D *_ctx) :
>>> + pp::SimpleThread(instance),
>>> + ctx(_ctx),
>>> + cbf(this)
>>> + {
>>> + Start();
>>> + sem_init(&sem, 0, 0);
>>> + }
>>> +
>>> + ~NaclSwapThread()
>>> + {
>>> + sem_destroy(&sem);
>>> + message_loop().PostQuit(true);
>>> + }
>>> +
>>> + bool swap()
>>> + {
>>> + pp::CompletionCallback cb =
>>> + cbf.NewCallback(&NaclSwapThread::swap_buffers);
>>> +
>>> + if (message_loop().PostWork(cb) != PP_OK)
>>> + return false;
>>
>> I don't understand NaCl's message loop. When you post a callback
>> to the message loop, does NaCl provide any guarantees on which
>> thread executes the callback?
>
> message_loop() is method of SimpleThread so here it returns the message_loop
> of NaclSwapThread, I used the method because examples I've seen did this. I
> could've done also 'message_loop_.PostWork(cb)'. I can change this if it
> feels/looks bad (?)
The code is fine and doesn't look bad. I asked the question just for
self-learning.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ waffle mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/waffle

