Can calls to library be executed simultaneously from different threads (Is library thread-safe) ?

Support for the Milan Intelligent interface, sold by Money Controls as the Paylink USB unit and for the earlier PCI card version.

Moderators: aardvark, davebush, Admin

Post Reply
Brzeczek
Posts: 8
Joined: Tue Jul 15, 2025 5:55 am

Can calls to library be executed simultaneously from different threads (Is library thread-safe) ?

Post by Brzeczek »

Hi,
I'm trying to create program that handles Hopper and Note Acceptor.
In LinuxDemo that is attached to examples I saw that few tasks (e.g. DataFn_UpdateDispensers or DataFn_AcceptorUpdateData) are scheduled with use of g_timeout_add (tasks processed in main thread). Can I run many calls from different threads to Paylink or i must process them sequentially ?
davebush
Posts: 490
Joined: Fri Oct 22, 2004 12:20 pm

Re: Can calls to library be executed simultaneously from different threads (Is library thread-safe) ?

Post by davebush »

Hi,

Nothing in the API was specifically designed to be thread safe. That said, all the API calls that are essentially reading values from the Paylink are safe.

However those issuing commands or modifying peripheral behaviour are theoretically capable of triggering the Paylink unit into action part way though the update.

The window is only 3 or 4 instructions, so it is unlikely to ever cause a problem, but to be safe I would serialize those calls.

Regards

Dave
Aardvark software developer. Please put all communication on the problem through the board for the benefit of others.
Post Reply