]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | # Civetweb API Reference |
2 | ||
3 | ### `mg_lock_connection( conn );` | |
4 | ||
5 | ### Parameters | |
6 | ||
7 | | Parameter | Type | Description | | |
8 | |**`conn`**|`struct mg_connection *`|The connection to retrieve a lock| | |
9 | ||
10 | ### Return Value | |
11 | ||
12 | *none* | |
13 | ||
14 | ### Description | |
15 | ||
16 | The function `mg_lock_connection()` is specifically for websocket connections to lock connection. Using this function in combination with [`mg_unlock_connection();`](mg_unlock_connection.md) is necessary around [`mg_write()`](mg_write.md) and [`mg_printf()`](mg_printf.md) calls if the code has server-initiated communication, as well as with communication in direct response to a message. | |
17 | ||
18 | ### See Also | |
19 | ||
20 | * [`mg_lock_context();`](mg_lock_context.md) | |
21 | * [`mg_printf();`](mg_printf.md) | |
22 | * [`mg_unlock_connection();`](mg_unlock_connection.md) | |
23 | * [`mg_unlock_context();`](mg_unlock_context.md) | |
24 | * [`mg_websocket_client_write();`](mg_websocket_client_write.md) | |
25 | * [`mg_websocket_write();`](mg_websocket_write.md) | |
26 | * [`mg_write();`](mg_write.md) |