|
Packit |
4d0513 |
/*
|
|
Packit |
4d0513 |
* Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
Packit |
4d0513 |
* copy of this software and associated documentation files (the "Software"),
|
|
Packit |
4d0513 |
* to deal in the Software without restriction, including without limitation
|
|
Packit |
4d0513 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
Packit |
4d0513 |
* and/or sell copies of the Software, and to permit persons to whom the
|
|
Packit |
4d0513 |
* Software is furnished to do so, subject to the following conditions:
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* The above copyright notice and this permission notice shall be included in
|
|
Packit |
4d0513 |
* all copies or substantial portions of the Software.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit |
4d0513 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit |
4d0513 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
Packit |
4d0513 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
Packit |
4d0513 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
Packit |
4d0513 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
Packit |
4d0513 |
* DEALINGS IN THE SOFTWARE.
|
|
Packit |
4d0513 |
*/
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
#ifndef WAYLAND_THREAD_H
|
|
Packit |
4d0513 |
#define WAYLAND_THREAD_H
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
#include <wayland-client.h>
|
|
Packit |
4d0513 |
#include <pthread.h>
|
|
Packit |
4d0513 |
#include <stdbool.h>
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
/*
|
|
Packit |
4d0513 |
* wlExternalApiLock()
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Tries to acquire the external API lock. If the lock is already acquired by
|
|
Packit |
4d0513 |
* another thread, it will block until the lock is released.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Calling this function twice without calling wlExternalApiUnlock() in between
|
|
Packit |
4d0513 |
* will fail.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* First call to wlExternalApiLock() will initialize the external API lock
|
|
Packit |
4d0513 |
* resources.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Returns 0 upon success; otherwise returns -1.
|
|
Packit |
4d0513 |
*/
|
|
Packit |
4d0513 |
int wlExternalApiLock(void);
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
/*
|
|
Packit |
4d0513 |
* wlExternalApiUnlock()
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Releases the external API lock.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Calling this function without a previous call to wlExternalApiLock() will
|
|
Packit |
4d0513 |
* fail.
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Returns 0 upon success; otherwise returns -1.
|
|
Packit |
4d0513 |
*/
|
|
Packit |
4d0513 |
int wlExternalApiUnlock(void);
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
/*
|
|
Packit |
4d0513 |
* wlExternalApiDestroyLock()
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Releases and frees the the external API lock resources. This call should only
|
|
Packit |
4d0513 |
* be called as part of the global teardown.
|
|
Packit |
4d0513 |
*/
|
|
Packit |
4d0513 |
void wlExternalApiDestroyLock(void);
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
/*
|
|
Packit |
4d0513 |
* wlEglInitializeMutex(pthread_mutex_t *mutex)
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Initialises the pthread mutex referenced by mutex.
|
|
Packit |
4d0513 |
*/
|
|
Packit |
4d0513 |
bool wlEglInitializeMutex(pthread_mutex_t *mutex);
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
/*
|
|
Packit |
4d0513 |
* wlEglMutexDestroy(pthread_mutex_t *mutex)
|
|
Packit |
4d0513 |
*
|
|
Packit |
4d0513 |
* Destroys the pthread mutex referenced by mutex.
|
|
Packit |
4d0513 |
*/
|
|
Packit |
4d0513 |
void wlEglMutexDestroy(pthread_mutex_t *mutex);
|
|
Packit |
4d0513 |
|
|
Packit |
4d0513 |
#endif
|