Roel De Nijs wrote:
If you are always booking record number 0 (comment line 62), you wouldn't see 35 'booked no room' messages, because one client should have booked room 0, all other threads shouldn't be able to book the room.
Roel De Nijs wrote:
So your original output is not what you should expect. And your "fix" is also questionable: changing it into a class variable which will be modified by a bunch of threads (in a non thread-safe way). I don't see how this could fix your initial problem.
Roel De Nijs wrote:
Martin Vanyavchich wrote:Now the record number gets incremented, and rooms 0 trough 35 get booked.
That's also weird. I don't think your database file contains 35 records at the start.
fred rosenberger wrote:Concatenate your input string with a string 35 of your 'special characters'
return a substring of that, from 0-34