Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How I can organize a processes or threads synchronization to update the UI [model - C] --> [UI - Objective-C /Swift]?

1) The application model should work independently(a separate process or thread) since it has an endless cycle for receiving requests and it's written in C;

2) For every new request in the model(in C) I must send a data to a bridge module(in Objective-C) synchronously.After that to update the properties of NSViewController object(in Swift) is easy.

PARALLEL PROCESSES:

Model(in C) [the child process] --> Bridge(in Objective-C) [the parent process] --> Interface(in Swift) [ the parent process]

If I work with processes in this case for data sending I use the IPC instruments (like messages or shared resources). For notifications to updating Interface from Model I use signals(like SIGINT) i.e. my Model(in C) send a signal to Bridge(Objective-C.But already at this step you can feel a something wrong. First of all the signals not always are being processed by the parent process when project divided into several languages(I'm saying even about reliable signals).On the other side I can't send a large of different signals obviously.

The question is how can I built a structured system for interface updating if Model(in C) and Bridge(in Objective-C) with Interface(in Swift) are performing by various processes?

MULTITHREADING:

If to consider threads then in the Model(in C) [the child thread] I call refresh function is implemented in Bridge(in Objective-C)[the child thread](but it's like an ugly delegation) and this function updates a Label object in Interface(in Swift)[the child thread]. But at this step NSViewController throws an exception(it is not main queue).

Comments