shared transaction ID function among multiple threads
- 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
}
my concern is how to sync between two or more threads so that transaction id can be unique among them without using mutex, is this possible?
Please share anything even if I need to change linked list to something else.