<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Richard Palethorpe <<a href="mailto:rpalethorpe@suse.de">rpalethorpe@suse.de</a>> wrote:<br></div><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>> must wrap the user supplied function. You can create a function which<br>
>> accepts a pointer to some contiguous memory containing the user supplied<br>
>> function<br>
>> pointer and the user supplied arg pointer.<br>
>><br>
><br>
> Since you have fixed the function format of thread B as void *(*run_b)(void<br>
> *) in tst_fzsync_pair_reset(), which means we have no need to take care of<br>
> the function arg pointer anymore.<br>
<br>
I think the function pointer signature would be 'void *(*run_b)(void)'<br>
not 'void *(*run_b)(void *)'.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Hmm, but at least we should respect the pthread_create()? It requires the function prototype is ''void *(*func)(void *)'.</div><div class="gmail_default" style="font-size:small"><br></div> int pthread_create(pthread_t *thread, const pthread_attr_t *attr,<br> void *(*start_routine) (void *), void *arg);<br></div><div> </div><div><div class="gmail_default" style="font-size:small">We could unuse the arg in thread B, but declare the function prototype with parameter "void *" is no harm.</div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I doubt any test would need the arg though, because we only use one<br>
thread and can store parameters in global variables. So you could remove<br>
it and update the tests.<br>
<br>
The user might need that arg if they are starting many threads, but for<br>
now we don't have explicit support for that in the library.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Maybe we just need to note that in the lib document.</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
><br>
> So just like what I did in V2, the wrapper function could steal the real<br>
> run_b address from pthread_create(..., wrap_run_b, run_b) parameter.<br>
<br>
<br>
--<br>
Thank you,<br>
Richard.<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>