Hi.

I am in the middle of refactoring a library, which I am going to publish
open source.
I found mysefl stuck reconsidering API in terms of interobject
communication.

There is a central class that have several signals, and I try to imagine
what library user could do in corresponding slots:
Should deleting an instance be possible from directly connected slot?
What should happen if one reenters event loop in a directly connected slot?
Should processing continue or lock?

In general, API is asynchronous in sense that methods just set some target
state and use queued connection to do processing from event loop and
signals just mark some events.

Qt itself has nice documentation that, for example, flags some method to be
reentrant or thead safe. But synchronous or asynchronous, event loop
reentry or deletion behavior is rarely described in detailed section. So I
struggle to find a reference implementation.

I wonder:
Does anyone consider these problems designing or using APIs?
Do you expect an object to continue processing even if control flow was
taken into event loop via direct signal slot connection?
What is the correct term or category to define event loop reentry safety?

Will appreciate any comments.
Wishes.

https://doc.qt.io/qt-5/signalsandslots.html
https://doc.qt.io/qt-5/threads-reentrancy.html
https://doc.qt.io/qt-5/qiodevice.html#bytesWritten
https://doc.qt.io/qt-5/qthread.html#finished
https://wiki.qt.io/API_Design_Principles
https://github.com/qt/qtbase/blob/5.12/src/corelib/thread/qthread_win.cpp#L403
https://github.com/qt/qtbase/blob/5.12/src/corelib/thread/qthread_unix.cpp#L400
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to