Newer
Older
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
#include <pthread.h>
void *pthread_getspecific( pthread_key_t key )
</PRE>
<P>
<B>Description:</B>
<P>
The <I>pthread_getspecific()</I> function returns the value
currently bound to the specified key on behalf of the
calling thread.
<P>
The effect of calling <I>pthread_getspecific()</I> with a key value
not obtained from <I>pthread_key_create()</I> or after a key has been
deleted with <I>pthread_key_delete()</I> is undefined.
<P>
<B>Input Parameters:</B>
<P>
<UL>
<LI><I>key</I>. The data key to get the binding for.
</UL>
<P>
<B>Returned Values:</B>
<P>
The function <I>pthread_getspecific()</I> returns the thread-
specific data associated with the given key. If no
thread specific data is associated with the key, then
the value <I>NULL</I> is returned.
<P>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<UL>
<LI>pthread_getspecific() may be called from a thread-specific data
destructor function.
</UL>
<H3><a name="pthreadkeydelete">2.9.25 pthread_key_delete</A></H3>
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_key_delete( pthread_key_t key )
</PRE>
<P>
<B>Description:</B>
<P>
This POSIX function should delete a thread-specific data
key previously returned by <I>pthread_key_create()</I>. However,
this function does nothing in the present implementation.
<P>
<B>Input Parameters:</B>
<P>
<UL>
<LI><I>key</I>. The key to delete
</UL>
<P>
<B>Returned Values:</B>
<P>
<UL>
<LI>Always returns <I>EINVAL</I>.
</UL>
<P>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexattrinit">2.9.26 pthread_mutexattr_init</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutexattr_init(pthread_mutexattr_t *attr);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutexattr_init()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexattrdestroy">2.9.27 pthread_mutexattr_destroy</A></H3>
<P>
<B>Function Protoype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutexattr_destroy()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexattrgetpshared">2.9.28 pthread_mutexattr_getpshared</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr,
int *pshared);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutexattr_getpshared()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexattrsetpshared">2.9.29 pthread_mutexattr_setpshared</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
int pshared);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutexattr_setpshared()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexinit">2.9.30 pthread_mutex_init</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutex_init(pthread_mutex_t *mutex,
pthread_mutexattr_t *attr);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutex_init()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexdestrory">2.9.31 pthread_mutex_destroy</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutex_destroy(pthread_mutex_t *mutex);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutex_destroy()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexlock">2.9.32 pthread_mutex_lock</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutex_lock(pthread_mutex_t *mutex);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutex_lock()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutextrylock">2.9.33 pthread_mutex_trylock</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutex_trylock(pthread_mutex_t *mutex);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutex_trylock()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadmutexunlock">2.9.34 pthread_mutex_unlock</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_mutex_unlock(pthread_mutex_t *mutex);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_mutex_unlock()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadconaddrinit">2.9.35 pthread_condattr_init</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_condattr_init(pthread_condattr_t *attr);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_condattr_init()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadocndattrdestroy">2.9.36 pthread_condattr_destroy</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_condattr_destroy(pthread_condattr_t *attr);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_condattr_destroy()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadcondinit">2.9.37 pthread_cond_init</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_cond_init()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadconddestroy">2.9.38 pthread_cond_destroy</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_cond_destroy(pthread_cond_t *cond);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_cond_destroy()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadcondbroadcast">2.9.39 pthread_cond_broadcast</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_cond_broadcast(pthread_cond_t *cond);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_cond_broadcast()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadcondsignal">2.9.40 pthread_cond_signal</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_cond_signal(pthread_cond_t *dond);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_cond_signal()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadcondwait">2.9.41 pthread_cond_wait</A></H3>
<P>
<B>Function Prototype:</B>
<P>
<PRE>
#include <pthread.h>
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
</PRE>
<P>
<B>Description:</B>
<P>
<B>Input Parameters:</B>
<P>
<UL>
If successful, the <I>pthread_cond_wait()</I> function will return
zero (<I>OK</I>). Otherwise, an error number will be
returned to indicate the error:
<P>
<UL>
</UL>
<B>Assumptions/Limitations:</B>
<P>
<B>POSIX Compatibility:</B> Comparable to the POSIX
interface of the same name.
<H3><a name="pthreadcondtimedwait">2.9.42 pthread_cond_timedwait</A></H3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
const struct timespec *abstime);
</pre>
<p>
<b>Description:</b>
</p>
<p>
<b>Input Parameters:</b>
</p>
<p>
<ul>
<li><code>parm</code>.</li>
</ul>
<p>
<b>Returned Values:</b>
</p>
<p>
If successful, the <code>pthread_cond_timedwait()</code> function will return
zero (<code>OK</code>). Otherwise, an error number will be
returned to indicate the error:
</p>
<ul>
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
</ul>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierattrinit">2.9.43 pthread_barrierattr_init</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr);
</pre>
<p>
<b>Description:</b>
The <code>pthread_barrierattr_init()</code> function will initialize a barrier
attribute object <code>attr</code> with the default value for all of the attributes
defined by the implementation.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li>
<code>attr</code>. Barrier attributes to be initialized.
</li>
</ul>
<p>
<b>Returned Values:</b>
0 (<code>OK</code>) on success or <code>EINVAL</code> if <code>attr</code> is invalid.
</p>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierattrdestroy">2.9.44 pthread_barrierattr_destroy</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr);
</pre>
<p>
<b>Description:</b>
The <code>pthread_barrierattr_destroy()</code> function will destroy a barrier attributes object.
A destroyed attributes object can be reinitialized using <code>pthread_barrierattr_init()</code>;
the results of otherwise referencing the object after it has been destroyed are undefined.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li>
<code>attr</code>. Barrier attributes to be destroyed.
</li>
</ul>
<p>
<b>Returned Values:</b> 0 (OK) on success or EINVAL if attr is invalid.
</p>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierattrsetpshared">2.9.45 pthread_barrierattr_setpshared</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared);
</pre>
<p>
<b>Description:</b>
The process-shared attribute is set to <code>PTHREAD_PROCESS_SHARED</code> to permit
a barrier to be operated upon by any thread that has access to the memory where the
barrier is allocated.
If the process-shared attribute is <code>PTHREAD_PROCESS_PRIVATE</code>, the barrier can
only be operated upon by threads created within the same process as the thread that
initialized the barrier.
If threads of different processes attempt to operate on such a barrier, the behavior is undefined.
The default value of the attribute is <code>PTHREAD_PROCESS_PRIVATE</code>.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li><code>attr</code>. Barrier attributes to be modified.</li>
<li><code>pshared</code>. The new value of the pshared attribute.</li>
</ul>
<p>
<b>Returned Values:</b> 0 (<code>OK</code>) on success or <code>EINVAL</code> if either
<code>attr</code> is invalid or <code>pshared</code> is not one of
<code>PTHREAD_PROCESS_SHARED</code> or <code>PTHREAD_PROCESS_PRIVATE</code>.
</p>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierattrgetpshared">2.9.46 pthread_barrierattr_getpshared</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR int *pshared);
</pre>
<p>
<b>Description:</b>
The <code>pthread_barrierattr_getpshared()</code> function will obtain the value of the
process-shared attribute from the attributes object referenced by <code>attr</code>.
</p>
<p>
<b>Input Parameters:</b>
</p>
<p>
<ul>
<li><code>attr</code>. Barrier attributes to be queried.</li>
<li><code>pshared</code>. The location to stored the current value of the pshared attribute.</li>
</ul>
<p>
<b>Returned Values:</b> 0 (<code>OK</code>) on success or <code>EINVAL</code> if
either <code>attr</code> or <code>pshared</code> is invalid.
</p>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierinit">2.9.47 pthread_barrier_init</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrier_init(FAR pthread_barrier_t *barrier,
FAR const pthread_barrierattr_t *attr, unsigned int count);
</pre>
<p>
<b>Description:</b>
The <code>pthread_barrier_init()</code> function allocates any resources required to
use the barrier referenced by <code>barrier</code> and initialized the barrier with
the attributes referenced by <code>attr</code>.
If <code>attr</code> is NULL, the default barrier attributes will be used.
The results are undefined if <code>pthread_barrier_init()</code> is called when any
thread is blocked on the barrier.
The results are undefined if a barrier is used without first being initialized.
The results are undefined if <code>pthread_barrier_init()</code> is called specifying
an already initialized barrier.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li>
<code>barrier</code>.
The barrier to be initialized.
</li>
<li>
<code>attr</code>.
Barrier attributes to be used in the initialization.
</li>
<li>
<code>count</code>.
The count to be associated with the barrier.
The count argument specifies the number of threads that must call
<code>pthread_barrier_wait()</code> before any of them successfully return from the call.
The value specified by count must be greater than zero.
</li>
</ul>
<p>
<b>Returned Values:</b>0 (OK) on success or on of the following error numbers:
</p>
<ul>
<li>
<code>EAGAIN</code>.
The system lacks the necessary resources to initialize another barrier.
</li>
<li>
<code>EINVAL</code>.
The barrier reference is invalid, or the values specified by attr are invalid, or
the value specified by count is equal to zero.
</li>
<li>
<code>ENOMEM</code>.
Insufficient memory exists to initialize the barrier.
</li>
<li>
<code>EBUSY</code>.
The implementation has detected an attempt to reinitialize a barrier while it is in use.
</li>
</ul>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierdestroy">2.9.48 pthread_barrier_destroy</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrier_destroy(FAR pthread_barrier_t *barrier);
</pre>
<p>
<b>Description:</b>
The <code>pthread_barrier_destroy()</code> function destroys the barrier referenced
by <code>barrie</code> and releases any resources used by the barrier.
The effect of subsequent use of the barrier is undefined until the barrier is
reinitialized by another call to <code>pthread_barrier_init()</code>.
The results are undefined if <code>pthread_barrier_destroy()</code> is called when
any thread is blocked on the barrier, or if this function is called with an
uninitialized barrier.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li><code>barrier</code>. The barrier to be destroyed.</li>
</ul>
<p>
<b>Returned Values:</b> 0 (<code>OK</code>) on success or on of the following error numbers:
</p>
<ul>
<li>
<code>EBUSY</code>.
The implementation has detected an attempt to destroy a barrier while it is in use.
</li>
<li>
<code>EINVAL</code>.
The value specified by barrier is invalid.
</li>
</ul>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadbarrierwait">2.9.49 pthread_barrier_wait</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_barrier_wait(FAR pthread_barrier_t *barrier);
</pre>
<p>
<b>Description:</b>
The <code>pthread_barrier_wait()</code> function synchronizse participating
threads at the barrier referenced by <code>barrier</code>.
The calling thread is blocked until the required number of threads have called
<code>pthread_barrier_wait()</code> specifying the same <code>barrier</code>.
When the required number of threads have called <code>pthread_barrier_wait()</code>
specifying the <code>barrier</code>, the constant <code>PTHREAD_BARRIER_SERIAL_THREAD</code>
will be returned to one unspecified thread and zero will be returned to each of
the remaining threads.
At this point, the barrier will be reset to the state it had as a result of the most
recent <code>pthread_barrier_init()</code> function that referenced it.
</p>
<p>
The constant <code>PTHREAD_BARRIER_SERIAL_THREAD</code> is defined in
<code>pthread.h</code> and its value must be distinct from any other value
returned by <code>pthread_barrier_wait()</code>.
</p>
<p>
The results are undefined if this function is called with an uninitialized barrier.
</p>
<p>
If a signal is delivered to a thread blocked on a barrier, upon return from the
signal handler the thread will resume waiting at the barrier if the barrier wait
has not completed.
Otherwise, the thread will continue as normal from the completed barrier wait.
Until the thread in the signal handler returns from it, it is unspecified whether
other threads may proceed past the barrier once they have all reached it.
</p>
<p>
A thread that has blocked on a barrier will not prevent any unblocked thread that
is eligible to use the same processing resources from eventually making forward
progress in its execution.
Eligibility for processing resources will be determined by the scheduling policy.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li><code>barrier</code>. The barrier on which to wait.</li>
</ul>
<p>
<b>Returned Values:</b> 0 (<code>OK</code>) on success or <code>EINVAL</code> if the barrier is not valid.
</p>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadonce">2.9.50 pthread_once</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <pthread.h>
int pthread_once(FAR pthread_once_t *once_control, CODE void (*init_routine)(void));
</pre>
<p>
<b>Description:</b>
The first call to <code>pthread_once()</code> by any thread with a given
<code>once_control</code>, will call the <code>init_routine()</code> with no arguments.
Subsequent calls to <code>pthread_once()</code> with the same <code>once_control</code> will have no effect.
On return from <code>pthread_once()</code>, <code>init_routine()</code> will have completed.
</p>
<p>
<b>Input Parameters:</b>
</p>
<p>
<ul>
<li>
<code>once_control</code>.
Determines if <code>init_routine()</code> should be called.
<code>once_control</code> should be declared and intialized as follows:
<ul><pre>pthread_once_t once_control = PTHREAD_ONCE_INIT;
</pre></ul>
<code>PTHREAD_ONCE_INIT</code> is defined in <code>pthread.h</code>.
</li>
<li>
<code>init_routine</code>.
The initialization routine that will be called once.
</li>
</ul>
<p>
<b>Returned Values:</b>
0 (OK) on success or EINVAL if either once_control or init_routine are invalid.
</p>
<p>
<b>Assumptions/Limitations:</b>
</p>
<p>
<b>POSIX Compatibility:</b> Comparable to the POSIX interface of the same name.
</p>
<h3><a name="pthreadkill">2.9.51 pthread_kill</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include <signal.h>
#include <pthread.h>
int pthread_kill(pthread_t thread, int signo)
</pre>
<p>
<b>Description:</b>
The <code>pthread_kill()</code> system call can be used to send any
signal to a thread. See <code>kill()</code> for further information
as this is just a simple wrapper around the <code>kill()</code>
function.
</p>
<p>
<b>Input Parameters:</b>
</p>
<p>
<ul>
<li>
<code>thread</code>.
The id of the thread to receive the signal. Only positive, non-zero values of <code>tthread</code>t are supported.
</li>
<li>
<code>signo</code>.
The signal number to send. If <code>signo</code> is zero, no signal is sent, but all error checking is performed.
</li>
</ul>
<p>
<b>Returned Values:</b>
</p>
<p>
On success, the signal was sent and zero is returned.
On error one of the following error numbers is returned.
</p>
<ul>
<li>
<code>EINVAL</code>.
An invalid signal was specified.
</li>
<li>