Ionic 2 : Use a semaphore or lock


#1

Hello, i want synchronized the methods of injected service.
My service uses NativeStorage to store and write datas, and many events can call this service in concurrency.
So, i need to synchronize this operations. I want use a semaphore (a system lock-release), but i don’t found the equivalent in ionic.
Any solution ?
Thanks in advance.


#2

I’m curious why you need this. What bad thing happens if you can’t control the order of reads and writes?


#3

In fact, I need to make a transaction.
When I load and verify the data, I want to block write calls.


#4

Is there no way to define the objects being stored large enough that everything that needs to be done in a transaction can be done in a single read or write?