I realize that what I'm about to ask is more a generic Java question than a specific Codename One question, anyway, considering that the reference APIs are Codename One's, is there a more elegant and more reliable way to handle a situation like the following code? Such cases happen if I need to synchronously make code that by its nature would be asynchronous with callback:
while (lock) {
CN.invokeAndBlock(() -> Util.sleep(500));
}
I quoted a code like that here: https://github.com/codenameone/CodenameOne/issues/3192