RES: doubt about thread pool



John,

        Thanks for the answer. Actually, I am implementing it just as the first method you said, sending a message from the thread to my "thread manager" class. I just don't like it too much, as my thread needs to know my thread manager exists, therefore increasing coupling. I will take a look at this g_idle_add.
        About the list, I am sorry for that, I am new to these lists and didn't figure out each one yet. Gtk-app-devel is for questions related to gtk and glib application development and gtk-list is for discussion about gtk itself, like it's architecture, suggestions for mods, etc.  Is it?

Regards,
Marcelo Valle.

-----Mensagem original-----
De: jcupitt gmail com [mailto:jcupitt gmail com]
Enviada em: terça-feira, 6 de dezembro de 2011 09:57
Para: Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP -
Cc: gtk-list gnome org
Assunto: Re: doubt about thread pool

On 6 December 2011 11:49, Marcelo Elias Del Valle - SYSMAP SOLUTIONS -
Claro MA-SP - <Marcelo Valle claro com br> wrote:
>        When I call g_thread_pool_push, I pass a pointer to some data I have pre-allocated and that should be processed by the thread. However, when the thread finishes processing it, I need to free this data, outside the thread.
>        How do I do that? Is there a way?

You need to send a message back from the thread saying "I'm done!"

There are many ways to do this, depending on how your program is
structured. For example, g_idle_add() is a very simple thread-safe way
for a worker to get the main GUI thread to call a function.

(this question might be better on gtk-app-devel, for future reference)

John

Esta mensagem, incluindo seus eventuais anexos, pode conter informações confidenciais, de uso restrito e/ou legalmente protegidas. Se você recebeu esta mensagem por engano, não deve usar, copiar, divulgar, distribuir ou tomar qualquer atitude com base nestas informações. Solicitamos que você elimine a mensagem imediatamente de seu sistema e avise-nos, enviando uma mensagem diretamente para o remetente e para postmaster claro com br. Todas as opiniões, conclusões ou informações contidas nesta mensagem somente serão consideradas como provenientes da Claro ou de suas subsidiárias quando efetivamente confirmadas, formalmente, por um de seus representantes legais, devidamente autorizados para tanto.
------------------------------------------------------------------------------
Este mensaje, incluyendo sus eventuales archivos adjuntos, puede contener informaciones confidenciales, de uso restringido y/o legalmente protegidas. Si usted ha recibido este mensaje por error, no debe utilizar, copiar, divulgar, distribuir o tomar cualquier actitud basada en estas informaciones. Solicitamos la inmediata eliminación del mensaje de su sistema y el envío de un informe en forma directa al remitente y a postmaster claro com br. Todas las opiniones, conclusiones o informaciones contenidas en este mensaje solamente serán consideradas como provenientes de Claro o de sus subsidiarias cuando sean efectivamente confirmadas, formalmente, a través de uno de sus representantes legales debidamente autorizados a tal fin.
------------------------------------------------------------------------------
This message, including all attachments transmitted with it may include restricted, legally privileged, and/or confidential information. If you received this message by mistake or in error you are hereby notified that you must not use, publicize, copy, distribute, resend, or take any action based on the information contained in the message. We ask you to delete the message immediately from your system and advise us by sending a message directly


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]