[GSoC] Integrating LO with GNOME - WR#8

Tomaž Vajngerl quikee at gmail.com
Mon Jul 20 03:44:40 PDT 2015


Hi,

On Mon, Jul 20, 2015 at 7:02 PM, Pranav Kant <pranav913 at gmail.com> wrote:
>> I am making use of thread pool, but this pool consists of only single
>> thread. All the LOK calls will be queued and can reuse this thread,
>> hence saving me the time that it would take to create a new thread
>> (expensive process) for each LOK call.
>>
>> This was the reason behind making use of thread pool. I had no
>> intention of using more than one thread for LOK calls.

You can create only one thread on start and put the processing of
async queue in a loop there:

while (message = async_queue.pop())
{
...process message...
}

from other thread just push the messages that you want to process in
the other thread into the queue (btw. this is what is done in Android
implementation).

The queue will block if you "pop" and there are no messages in th
queue - which means the thread will sleep until a new message arrives.

Look at: https://developer.gnome.org/glib/stable/glib-Asynchronous-Queues.html

As you can see the thread pool uses it also - but using thread pool
with only one thread is kind of a hack to me, but it works too..

> Regards,
> Pranav Kant
> http://pranavk.me


More information about the LibreOffice mailing list