[waffle] [PATCH v3] nacl: add implementation for waffle_window_swap_buffers

Chad Versace chad.versace at intel.com
Fri Feb 20 13:04:33 PST 2015


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/waffle/attachments/20150220/3e9e96a4/attachment.sig>


More information about the waffle mailing list