|
12 | 12 | /// The config level to be used with @ref SOCU_GetNetworkOpt |
13 | 13 | #define SOL_CONFIG 0xfffe |
14 | 14 |
|
15 | | -/// Default number of SOC sessions to initialize |
16 | | -#define SOC_DEFAULT_NUM_SESSIONS 3 |
| 15 | +/// Default number of SOC sessions to initialize, for backwards compatibility |
| 16 | +#define SOC_DEFAULT_NUM_SESSIONS 1 |
17 | 17 |
|
18 | 18 | /// Options to be used with @ref SOCU_GetNetworkOpt |
19 | 19 | typedef enum |
@@ -104,10 +104,19 @@ typedef struct |
104 | 104 | * @brief Initializes the SOC service. |
105 | 105 | * @param context_addr Address of a page-aligned (0x1000) buffer to be used. |
106 | 106 | * @param context_size Size of the buffer, a multiple of 0x1000. |
107 | | - * @param num_sessions The number of sessions to initialize. This value determines how many socket syscalls can be run concurrently. Setting it to 1 means only one thread can safely use socket syscalls. |
108 | 107 | * @note The specified context buffer can no longer be accessed by the process which called this function, since the userland permissions for this block are set to no-access. |
| 108 | + * @note The SOC service can only be used in a single thread when using this function to initialize SOC services. In order to enable usage across multiple threads, use @ref socInitMulti, otherwise threads will block when using socket functions concurrently. |
109 | 109 | */ |
110 | | -Result socInit(u32 *context_addr, u32 context_size, u32 num_sessions); |
| 110 | +Result socInit(u32 *context_addr, u32 context_size); |
| 111 | + |
| 112 | +/** |
| 113 | + * @brief Initializes the SOC service for use across multiple threads. |
| 114 | + * @param context_addr Address of a page-aligned (0x1000) buffer to be used. |
| 115 | + * @param context_size Size of the buffer, a multiple of 0x1000. |
| 116 | + * @param num_sessions The number of sessions to initialize. This value determines how many socket functions can be run concurrently. Setting it to 1 means only one thread can safely use socket functions. |
| 117 | + * @note The specified context buffer can no longer be accessed by the process which called this function, since the userland permissions for this block are set to no-access. |
| 118 | + */ |
| 119 | +Result socInitMulti(u32 *context_addr, u32 context_size, u32 num_sessions); |
111 | 120 |
|
112 | 121 | /** |
113 | 122 | * @brief Closes the soc service. |
|
0 commit comments