mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-06 05:02:40 +03:00
Renamed httplib_join_thread to httplib_pthread_join
This commit is contained in:
@@ -106,6 +106,7 @@ LibHTTP is often used as HTTP and HTTPS library inside a larger application. A
|
|||||||
* [`httplib_pthread_cond_timedwait( cv, mutex, abstime );`](api/httplib_pthread_cond_timedwait.md)
|
* [`httplib_pthread_cond_timedwait( cv, mutex, abstime );`](api/httplib_pthread_cond_timedwait.md)
|
||||||
* [`httplib_pthread_cond_wait( cv, mutex );`](api/httplib_pthread_cond_wait.md)
|
* [`httplib_pthread_cond_wait( cv, mutex );`](api/httplib_pthread_cond_wait.md)
|
||||||
* [`httplib_pthread_getspecific( key );`](api/httplib_pthread_getspecific.md)
|
* [`httplib_pthread_getspecific( key );`](api/httplib_pthread_getspecific.md)
|
||||||
|
* [`httplib_pthread_join( thread, value_ptr );`](api/httplib_pthread_join.md)
|
||||||
* [`httplib_pthread_key_create( key, destructor );`](api/httplib_pthread_key_create.md)
|
* [`httplib_pthread_key_create( key, destructor );`](api/httplib_pthread_key_create.md)
|
||||||
* [`httplib_pthread_key_delete( key );`](api/httplib_pthread_key_delete.md)
|
* [`httplib_pthread_key_delete( key );`](api/httplib_pthread_key_delete.md)
|
||||||
* [`httplib_pthread_mutex_destroy( mutex );`](api/httplib_pthread_mutex_destroy.md)
|
* [`httplib_pthread_mutex_destroy( mutex );`](api/httplib_pthread_mutex_destroy.md)
|
||||||
|
30
doc/api/httplib_pthread_join.md
Normal file
30
doc/api/httplib_pthread_join.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# LibHTTP API Reference
|
||||||
|
|
||||||
|
### `httplib_pthread_join( thread, value_ptr );`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
|**`key`**|`pthread_t`|The ID of the thread to join|
|
||||||
|
|**`value_ptr`**|`void *`|Optional pointer to location where the terminating thread stored exit information|
|
||||||
|
|
||||||
|
### Return Value
|
||||||
|
|
||||||
|
| Type | Description |
|
||||||
|
| :--- | :--- |
|
||||||
|
|`int`|Integer value with the result of the function|
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
The platform independent function `httplib_pthread_join()` suspends the execution of the current thread and waits until another thread specified as parameter has terminated. The function returns **0** when successful and a non zero error code if something goes wrong. On systems which support it, the functionality is implemented as a direct call to `pthread_join()`. Otherwise own code is used which emulates the same functionality.
|
||||||
|
|
||||||
|
The parameter `value_ptr` is an optional pointer to a location where an exit pointer of the terminated thread is stored. If this parameter is `NULL` no exit information will be sent back. Please note that the `value_ptr` has only be implemented on systems which use a fall-through to `pthread_join()` but is ignored in other implementations.
|
||||||
|
|
||||||
|
### See Also
|
||||||
|
|
||||||
|
* [`httplib_pthread_getspecific();`](httplib_pthread_getspecific.md)
|
||||||
|
* [`httplib_pthread_key_create();`](httplib_pthread_key_create.md)
|
||||||
|
* [`httplib_pthread_key_delete();`](httplib_pthread_key_delete.md)
|
||||||
|
* [`httplib_pthread_self();`](httplib_pthread_self.md)
|
||||||
|
* [`httplib_pthread_setspecific();`](httplib_pthread_setspecific.md)
|
@@ -978,6 +978,7 @@ LIBHTTP_API int httplib_pthread_cond_signal( pthread_cond_t *cv );
|
|||||||
LIBHTTP_API int httplib_pthread_cond_timedwait( pthread_cond_t *cv, pthread_mutex_t *mutex, const struct timespec *abstime );
|
LIBHTTP_API int httplib_pthread_cond_timedwait( pthread_cond_t *cv, pthread_mutex_t *mutex, const struct timespec *abstime );
|
||||||
LIBHTTP_API int httplib_pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mutex );
|
LIBHTTP_API int httplib_pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mutex );
|
||||||
LIBHTTP_API void * httplib_pthread_getspecific( pthread_key_t key );
|
LIBHTTP_API void * httplib_pthread_getspecific( pthread_key_t key );
|
||||||
|
LIBHTTP_API int httplib_pthread_join( pthread_t thread, void **value_ptr );
|
||||||
LIBHTTP_API int httplib_pthread_key_create( pthread_key_t *key, void (*destructor)(void *) );
|
LIBHTTP_API int httplib_pthread_key_create( pthread_key_t *key, void (*destructor)(void *) );
|
||||||
LIBHTTP_API int httplib_pthread_key_delete( pthread_key_t key );
|
LIBHTTP_API int httplib_pthread_key_delete( pthread_key_t key );
|
||||||
LIBHTTP_API int httplib_pthread_mutex_destroy( pthread_mutex_t *mutex );
|
LIBHTTP_API int httplib_pthread_mutex_destroy( pthread_mutex_t *mutex );
|
||||||
|
@@ -122,7 +122,7 @@ void httplib_close_connection( struct httplib_connection *conn ) {
|
|||||||
|
|
||||||
for (i=0; i<client_ctx->cfg_worker_threads; i++) {
|
for (i=0; i<client_ctx->cfg_worker_threads; i++) {
|
||||||
|
|
||||||
if ( client_ctx->workerthreadids[i] != 0 ) XX_httplib_join_thread( client_ctx->workerthreadids[i] );
|
if ( client_ctx->workerthreadids[i] != 0 ) httplib_pthread_join( client_ctx->workerthreadids[i], NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
httplib_free( client_ctx->workerthreadids );
|
httplib_free( client_ctx->workerthreadids );
|
||||||
|
@@ -843,7 +843,6 @@ bool XX_httplib_is_put_or_delete_method( const struct httplib_connection *conn
|
|||||||
bool XX_httplib_is_valid_http_method( const char *method );
|
bool XX_httplib_is_valid_http_method( const char *method );
|
||||||
int XX_httplib_is_valid_port( unsigned long port );
|
int XX_httplib_is_valid_port( unsigned long port );
|
||||||
bool XX_httplib_is_websocket_protocol( const struct httplib_connection *conn );
|
bool XX_httplib_is_websocket_protocol( const struct httplib_connection *conn );
|
||||||
int XX_httplib_join_thread( pthread_t threadid );
|
|
||||||
void * XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw );
|
void * XX_httplib_load_dll( struct httplib_context *ctx, const char *dll_name, struct ssl_func *sw );
|
||||||
void XX_httplib_log_access( const struct httplib_connection *conn );
|
void XX_httplib_log_access( const struct httplib_connection *conn );
|
||||||
int XX_httplib_match_prefix(const char *pattern, size_t pattern_len, const char *str);
|
int XX_httplib_match_prefix(const char *pattern, size_t pattern_len, const char *str);
|
||||||
|
@@ -147,7 +147,7 @@ static void master_thread_run(void *thread_func_param) {
|
|||||||
workerthreadcount = ctx->cfg_worker_threads;
|
workerthreadcount = ctx->cfg_worker_threads;
|
||||||
for (i=0; i<workerthreadcount; i++) {
|
for (i=0; i<workerthreadcount; i++) {
|
||||||
|
|
||||||
if ( ctx->workerthreadids[i] != 0 ) XX_httplib_join_thread(ctx->workerthreadids[i]);
|
if ( ctx->workerthreadids[i] != 0 ) httplib_pthread_join( ctx->workerthreadids[i], NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NO_SSL)
|
#if !defined(NO_SSL)
|
||||||
|
@@ -62,7 +62,7 @@ void httplib_stop( struct httplib_context *ctx ) {
|
|||||||
|
|
||||||
while ( ctx->stop_flag != 2 ) httplib_sleep( 10 );
|
while ( ctx->stop_flag != 2 ) httplib_sleep( 10 );
|
||||||
|
|
||||||
XX_httplib_join_thread( mt );
|
httplib_pthread_join( mt, NULL );
|
||||||
XX_httplib_free_context( ctx );
|
XX_httplib_free_context( ctx );
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
Reference in New Issue
Block a user