# Defining Data

{% hint style="warning" %}
## Thread Safety

The `data` field is **not thread-safe**, which means that Quebec can't ensure integrity of the data as it might be accessed by multiple threads at once. We might introduce a solution to this in the future using locks, but for now you have to use workarounds.
{% endhint %}

Sometimes you want your singletons to store data which changes overtime. To avoid your data from being overwritten **by accident from Quebec**, you can use the `data` field within your singleton. The framework will **NEVER** touch the data field and therefore your data is safe there.

{% code title="Example Service Using The Data Field" %}
```lua
local Service = {
    lifecycles = { "start", "onStep" },
    data = {
        counter = 0
    }
}

function Service:start()
    print("Counter is:", self.data.counter)
end

function Service:onStep(_dt)
    self.data.counter += 1
    
    print(self.data.counter)
end

return Service
```
{% endcode %}
