How to do inter-thread communication

Discussions about using 3rd party extension with

How to do inter-thread communication

Postby LRN » Mon Oct 07, 2019 4:19 pm

Let's say that i need to do something time-consuming. The normal way to go about it is to create a thread and make it do the work, then report back with the result.

Creating a thread is not difficult. The real question is how to communicate the result *back* from the worker thread to the main thread of my office extension. Extensions, AFAIK, do not run an event loop, so there might not even *be* a "main thread" of an extension at a given moment, just the office doing its thing. I thought that maybe i could register an XJobExecutor and then use the XAsyncJob to queue a job from the worker thread to be executed in the main thread - but it's difficult to find examples of something like this, and the SDK is almost completely silent on the subject of thread-safety.

This is compounded by the fact that i'm using Python (so i will probably need to use *processes* instead of threads (thank you, GIL!), which adds a whole new set of problems with regard to communication), and Python examples are almost non-existent (SDK has 1 (/one/) Python component example).
LibreOffice 3.2 NT 6.1.7601
Posts: 2
Joined: Tue May 10, 2011 10:55 am

Re: How to do inter-thread communication

Postby sasa » Mon Oct 07, 2019 5:17 pm


you can try solution in this thread, tested in dialogs and sidebar extension:

LibreOffice 6.3 on Xubuntu 18.04
Posts: 11
Joined: Wed Feb 08, 2017 12:54 am

Re: How to do inter-thread communication

Postby psilocybe » Thu Dec 19, 2019 5:38 pm


Take a look at my http server
It does two things.
- Waiting for a response from the OAuth2 consent screen ...
- Response with the appropriate redirect link.
LibreOffice - Lubuntu 16.10 - LxQt
Posts: 60
Joined: Thu Jun 15, 2017 5:33 am

Return to Extensions

Who is online

Users browsing this forum: No registered users and 3 guests