Search found 83 matches

by wxJack
Wed May 29, 2019 1:14 pm
Forum: C++ Development
Topic: Events & secondary threads
Replies: 14
Views: 204

Re: Events & secondary threads

Guys, many thanks for your answers. Really appreciate it! AddPendingEvent has the issue of wxString is not thread safe. For worker threads sending messages best use QueueEvent What do you mean saying that "AddPendingEvent has the issue of wxString is not thread safe"? Could you please explain this c...
by wxJack
Tue May 28, 2019 3:05 pm
Forum: C++ Development
Topic: Events & secondary threads
Replies: 14
Views: 204

Re: Events & secondary threads

No. "Calling an event handler" and "Handling an event" mean the same in this context. If you call ProcessEvent from a worker thread, the event will be handled (= its event handler will be called) immediately in the same thread context. Thanks for your reply! So you're telling me that, regardless of...
by wxJack
Tue May 28, 2019 1:01 pm
Forum: C++ Development
Topic: Events & secondary threads
Replies: 14
Views: 204

Re: Events & secondary threads

thank you very much for your answer the respective event handler will be called immediately in the same thread context as the caller. So, in order to avoid any misunderstanding, the event handler is immediately called by the worker/secondary thread (= the one you named the caller) but the event is p...
by wxJack
Tue May 28, 2019 8:32 am
Forum: C++ Development
Topic: Events & secondary threads
Replies: 14
Views: 204

Events & secondary threads

Hey there! I have a doubt about the way wxWidgets handles the handling of events. Scenario: I'm inside a secondary thread, and I want to send an event in order for the main one to process it and "do something". I do something like : m_parent->GetEventHandler()->ProcessEvent(eventToBeProcessed); I us...
by wxJack
Wed May 15, 2019 8:19 pm
Forum: C++ Development
Topic: wxThread detached deletion to avoid memory leaks
Replies: 4
Views: 123

Re: wxThread detached deletion to avoid memory leaks

Hi, There is even an example inside the wxThread documentation on how to write the thread code. What is missing? Thank you. You're right, I'm sorry. I was trying using the OnExit but it was not the right choice. The documentation you mentioned contains everything. Thank you! if you are using thread...
by wxJack
Mon May 13, 2019 1:08 pm
Forum: C++ Development
Topic: wxThread detached deletion to avoid memory leaks
Replies: 4
Views: 123

wxThread detached deletion to avoid memory leaks

Hello guys, this is a doubt that came up working on the same project I mention in my previous post but since this topic is a bit different, I open another thread. In case of double posting, sorry. My question: is there a way to write a function that activates only after that a secondary thread retur...
by wxJack
Sun May 12, 2019 7:56 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

It's the nature of modal dialogs that you can't use any controls of the underlying window of the same application. Just with a fileselector dialog, if you click outside, you just hear a ping, but you can't click on any button etc. This has nothing to do with the worker threads. The event loop of th...
by wxJack
Sat May 11, 2019 1:49 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

@ONEEYEMAN Thank you! I don't use wxBusyCursor in order for me to be able to stop the operations if I want. But why? You are not spewing data from some secondary device, right? I perform some long calculations and copy some files from a folder A to a folder B. Or if the calculation take place longer...
by wxJack
Fri May 10, 2019 3:40 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

@doublemax You mean: call from the menu of your bigger project a wxFrame and not a wxDialog (actually it was a wxWindow but I improperly called the class using the word dialog). Did I understand? Thanks a lot @ONEEYEMAN I am sorry if I was not clear, my bad! I don't want to use MT to perform simulta...
by wxJack
Fri May 10, 2019 3:21 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

Sorry, you're right I didn't clarify this. I want to put this dialog inside a bigger project. But if I open it from there, it blocks the main GUI that remains responsive but doesn't work until the dialog finishes its job. The wait statements put in the GUI thread of the little dialog seems to block ...
by wxJack
Fri May 10, 2019 12:52 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

Thank you guys for the answers. I read the suggested post, thank you, it's always good to me refresh my memory! The thing here is that even if I use some "wait" statements, the GUI thread is not blocked actually, and updates its table (wxListCtrl) in real time thanks to the MyDialog->getEventHandler...
by wxJack
Thu May 09, 2019 9:06 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

Why do you need the multi-threading? Hi, and thank you for your interest in my question. I need multi-threading in order to update the GUI in "real time" by means of events sent by 2ndary threads to the main one. Thank you very much. Put the code for t1 and t2 in one thread and just call them after...
by wxJack
Thu May 09, 2019 2:56 pm
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

Re: wxThread wait replacement

Thanks for the answer you kindly wrote doublemax. The problem here is: I want to do some tasks in a sequential order. Most of these tasks, performed by secondary threads, update the GUI by means of events. But I want this to happen in a precise order, so often I don't want a secondary thread to star...
by wxJack
Thu May 09, 2019 9:23 am
Forum: C++ Development
Topic: wxThread wait replacement
Replies: 22
Views: 428

wxThread wait replacement

Hello community! I'm curious about the behavior of threads. Let's say that I have a thread t1 and it runs inside the function f1 of the main one/GUI thread: is it possible, insidea second function f2 in the main thread/GUI thread, to replace the line "t1->wait()" line with something similar, using o...
by wxJack
Mon Nov 19, 2018 8:42 am
Forum: C++ Development
Topic: secondary thread accessing gui functions
Replies: 2
Views: 107

secondary thread accessing gui functions

Hi ! I know that " it is strongly recommended that no secondary threads call GUI functions " . I think it is mandatory for the writing operation, but what about the reading ones? Can I let a secondary thread t2 access to a wxListCtrl (whose pointer is passed inside the ctr) so t2 can read some value...