Merge "Nullability check for thread module"
This commit is contained in:
commit
dddea28a74
1 changed files with 21 additions and 21 deletions
|
@ -51,9 +51,9 @@ typedef pthread_key_t tss_t;
|
||||||
typedef pthread_mutex_t mtx_t;
|
typedef pthread_mutex_t mtx_t;
|
||||||
|
|
||||||
/** The type for a thread-specific storage destructor. */
|
/** The type for a thread-specific storage destructor. */
|
||||||
typedef void (*tss_dtor_t)(void*);
|
typedef void (*tss_dtor_t)(void* _Nullable);
|
||||||
/** The type of the function passed to thrd_create() to create a new thread. */
|
/** The type of the function passed to thrd_create() to create a new thread. */
|
||||||
typedef int (*thrd_start_t)(void*);
|
typedef int (*thrd_start_t)(void* _Nullable);
|
||||||
|
|
||||||
/** The type used by call_once(). */
|
/** The type used by call_once(). */
|
||||||
typedef pthread_once_t once_flag;
|
typedef pthread_once_t once_flag;
|
||||||
|
@ -82,72 +82,72 @@ __BEGIN_DECLS
|
||||||
// This file is implemented as static inlines before API level 30.
|
// This file is implemented as static inlines before API level 30.
|
||||||
|
|
||||||
/** Uses `__flag` to ensure that `__function` is called exactly once. */
|
/** Uses `__flag` to ensure that `__function` is called exactly once. */
|
||||||
void call_once(once_flag* __flag, void (*__function)(void)) __INTRODUCED_IN(30);
|
void call_once(once_flag* _Nonnull __flag, void (* _Nonnull __function)(void)) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unblocks all threads blocked on `__cond`.
|
* Unblocks all threads blocked on `__cond`.
|
||||||
*/
|
*/
|
||||||
int cnd_broadcast(cnd_t* __cond) __INTRODUCED_IN(30);
|
int cnd_broadcast(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a condition variable.
|
* Destroys a condition variable.
|
||||||
*/
|
*/
|
||||||
void cnd_destroy(cnd_t* __cond) __INTRODUCED_IN(30);
|
void cnd_destroy(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a condition variable.
|
* Creates a condition variable.
|
||||||
*/
|
*/
|
||||||
int cnd_init(cnd_t* __cond) __INTRODUCED_IN(30);
|
int cnd_init(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unblocks one thread blocked on `__cond`.
|
* Unblocks one thread blocked on `__cond`.
|
||||||
*/
|
*/
|
||||||
int cnd_signal(cnd_t* __cond) __INTRODUCED_IN(30);
|
int cnd_signal(cnd_t* _Nonnull __cond) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlocks `__mutex` and blocks until `__cond` is signaled or `__timeout` occurs.
|
* Unlocks `__mutex` and blocks until `__cond` is signaled or `__timeout` occurs.
|
||||||
*/
|
*/
|
||||||
int cnd_timedwait(cnd_t* __cond, mtx_t* __mutex, const struct timespec* __timeout)
|
int cnd_timedwait(cnd_t* _Nonnull __cond, mtx_t* _Nonnull __mutex, const struct timespec* _Nonnull __timeout)
|
||||||
__INTRODUCED_IN(30);
|
__INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlocks `__mutex` and blocks until `__cond` is signaled.
|
* Unlocks `__mutex` and blocks until `__cond` is signaled.
|
||||||
*/
|
*/
|
||||||
int cnd_wait(cnd_t* __cond, mtx_t* __mutex) __INTRODUCED_IN(30);
|
int cnd_wait(cnd_t* _Nonnull __cond, mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a mutex.
|
* Destroys a mutex.
|
||||||
*/
|
*/
|
||||||
void mtx_destroy(mtx_t* __mutex) __INTRODUCED_IN(30);
|
void mtx_destroy(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a mutex.
|
* Creates a mutex.
|
||||||
*/
|
*/
|
||||||
int mtx_init(mtx_t* __mutex, int __type) __INTRODUCED_IN(30);
|
int mtx_init(mtx_t* _Nonnull __mutex, int __type) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocks until `__mutex` is acquired.
|
* Blocks until `__mutex` is acquired.
|
||||||
*/
|
*/
|
||||||
int mtx_lock(mtx_t* __mutex) __INTRODUCED_IN(30);
|
int mtx_lock(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocks until `__mutex` is acquired or `__timeout` expires.
|
* Blocks until `__mutex` is acquired or `__timeout` expires.
|
||||||
*/
|
*/
|
||||||
int mtx_timedlock(mtx_t* __mutex, const struct timespec* __timeout) __INTRODUCED_IN(30);
|
int mtx_timedlock(mtx_t* _Nonnull __mutex, const struct timespec* _Nonnull __timeout) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquires `__mutex` or returns `thrd_busy`.
|
* Acquires `__mutex` or returns `thrd_busy`.
|
||||||
*/
|
*/
|
||||||
int mtx_trylock(mtx_t* __mutex) __INTRODUCED_IN(30);
|
int mtx_trylock(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlocks `__mutex`.
|
* Unlocks `__mutex`.
|
||||||
*/
|
*/
|
||||||
int mtx_unlock(mtx_t* __mutex) __INTRODUCED_IN(30);
|
int mtx_unlock(mtx_t* _Nonnull __mutex) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ int mtx_unlock(mtx_t* __mutex) __INTRODUCED_IN(30);
|
||||||
* Creates a new thread running `__function(__arg)`, and sets `*__thrd` to
|
* Creates a new thread running `__function(__arg)`, and sets `*__thrd` to
|
||||||
* the new thread.
|
* the new thread.
|
||||||
*/
|
*/
|
||||||
int thrd_create(thrd_t* __thrd, thrd_start_t __function, void* __arg) __INTRODUCED_IN(30);
|
int thrd_create(thrd_t* _Nonnull __thrd, thrd_start_t _Nonnull __function, void* _Nullable __arg) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the `thrd_t` corresponding to the caller.
|
* Returns the `thrd_t` corresponding to the caller.
|
||||||
|
@ -181,7 +181,7 @@ void thrd_exit(int __result) __noreturn __INTRODUCED_IN(30);
|
||||||
* Blocks until `__thrd` terminates. If `__result` is not null, `*__result`
|
* Blocks until `__thrd` terminates. If `__result` is not null, `*__result`
|
||||||
* is set to the exiting thread's result.
|
* is set to the exiting thread's result.
|
||||||
*/
|
*/
|
||||||
int thrd_join(thrd_t __thrd, int* __result) __INTRODUCED_IN(30);
|
int thrd_join(thrd_t __thrd, int* _Nullable __result) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocks the caller for at least `__duration` unless a signal is delivered.
|
* Blocks the caller for at least `__duration` unless a signal is delivered.
|
||||||
|
@ -190,7 +190,7 @@ int thrd_join(thrd_t __thrd, int* __result) __INTRODUCED_IN(30);
|
||||||
*
|
*
|
||||||
* Returns 0 on success, or -1 if a signal was delivered.
|
* Returns 0 on success, or -1 if a signal was delivered.
|
||||||
*/
|
*/
|
||||||
int thrd_sleep(const struct timespec* __duration, struct timespec* __remaining) __INTRODUCED_IN(30);
|
int thrd_sleep(const struct timespec* _Nonnull __duration, struct timespec* _Nullable __remaining) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request that other threads should be scheduled.
|
* Request that other threads should be scheduled.
|
||||||
|
@ -203,7 +203,7 @@ void thrd_yield(void) __INTRODUCED_IN(30);
|
||||||
* Creates a thread-specific storage key with the associated destructor (which
|
* Creates a thread-specific storage key with the associated destructor (which
|
||||||
* may be null).
|
* may be null).
|
||||||
*/
|
*/
|
||||||
int tss_create(tss_t* __key, tss_dtor_t __dtor) __INTRODUCED_IN(30);
|
int tss_create(tss_t* _Nonnull __key, tss_dtor_t _Nullable __dtor) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a thread-specific storage key.
|
* Destroys a thread-specific storage key.
|
||||||
|
@ -214,13 +214,13 @@ void tss_delete(tss_t __key) __INTRODUCED_IN(30);
|
||||||
* Returns the value for the current thread held in the thread-specific storage
|
* Returns the value for the current thread held in the thread-specific storage
|
||||||
* identified by `__key`.
|
* identified by `__key`.
|
||||||
*/
|
*/
|
||||||
void* tss_get(tss_t __key) __INTRODUCED_IN(30);
|
void* _Nullable tss_get(tss_t __key) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current thread's value for the thread-specific storage identified
|
* Sets the current thread's value for the thread-specific storage identified
|
||||||
* by `__key` to `__value`.
|
* by `__key` to `__value`.
|
||||||
*/
|
*/
|
||||||
int tss_set(tss_t __key, void* __value) __INTRODUCED_IN(30);
|
int tss_set(tss_t __key, void* _Nonnull __value) __INTRODUCED_IN(30);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue