Question: Basically the parameter of my args struct is changing before the first thread has an opportunity to access the struct and to read the information it receives. So for the code below, the first thread still reads `args.length` as 10 instead of as 5 like its meant to. I know this because when I add `sleep(1)` after the first `thread_create()`.

```
    pthread_t thread1, thread2;
    struct _args args;
    void *args_ptr = &args;

    args.length = 5;
    pthread_create(&thread1, NULL, array_add, args_ptr);
    args.length = 10;
    pthread_create(&thread2, NULL, array_add, args_ptr);

```

Can I Use a mutex to fix this?

In my program I am actually creating the threads in a for loop. So, both threads create calls, need to receive the same `args_ptr`; I could try to create a new args struct for every thread\_create call, but that feels strange. Any advice?

Answer: 
You could use a loop:

```
for d in lst:
    for v in d.values():
        for i, num in enumerate(v):
            v[i] = int(float(num))

print(lst)

```

Output:

```
[{'point1': [20, 15, 20],
  'point2': [0, 34, 8],
  'point3': [12, 15, 2],
  'point4': [15, 5, 16]}]

```
a [similar question](https://stackoverflow.com/questions/7368789/convert-all-strings-in-a-list-to-int) asked already check that too!
you can do this also:

```py
arr = [{
    'point1': ['20.900', '15.300', '20.400'], 
    'point2': ['0.600', '34.700', '8.100'], 
    'point3': ['12.100', '15.800', '2.300'], 
    'point4': ['15.000', '5.800', '16.900'],
    }]

[{k : list(map(float, v))  for k, v in point.items() } for point in arr]

```