Can Julia creat custom callback function?

Here is the discripitive code:

struct CallBack{T,N}
    condition::T
    call_back::N
end
struct Condition{T}
    condition::T
end
check_condition(cond::Condition{T}) where {T<:V{Int}} = cond.condition[end] == 1
call_back_func(cond::Condition{T}) where {T<:V{Int}} = println("condition is triggered")

create instance:

cond = Condition([1,2,3])
callback = CallBack(cond,call_back_func)

Then, whenever I do push!(cond.condition,1), there will be printed "condition is triggered".

Of course I can running a thread:

Threads.@spawn begin
    while true:
        if check_condition(callback.condition)
            callback.call_back(callback.condition)
        end
    end
end

But this will waste the computer resource. Is there any other way?

The better way would be to override push! for a type and check the condition there.