0
Исправлено

Реализация одиночки (singleton)

Artanov Dmitry 7 lat temu Ostatnio zmodyfikowane przez anonymous 7 lat temu 1

Нужно в псевдокод

static method getInstance() is

        if (this.instance == null) then
            acquireThreadLock() and then
                this.instance = new Singleton()

добавить ещё одну проверку

static method getInstance() is

        if (this.instance == null) then
            acquireThreadLock() and then
                if (this.instance == null) then
                    this.instance = new Singleton()

Odpowiedź

Odpowiedź
Исправлено

Исправил, спасибо!

Odpowiedź
Исправлено

Исправил, спасибо!