How can I sync between multiple threads so that their transaction ID be unique without using mutex?
- by poly
I'm writing an application in C that requires multiple threads to request a unique transaction ID from a function as shown below;
struct list{
int id;
struct list *next
};
function generate_id()
{
linked-list is built here to hold 10 millions
}
How can I sync between two or more threads so that their transaction ID be unique among them without using mutex, is it possible?
Please share anything even if I need to change linked list to something else.