libsoup Reference Manual | ||||
---|---|---|---|---|
SoupSessionSync; SoupSession* soup_session_sync_new (void); SoupSession* soup_session_sync_new_with_options (const char *optname1, ...);
SoupSessionSync is an implementation of SoupSession that uses synchronous I/O, intended for use in multi-threaded programs.
You can use SoupSessionSync from multiple threads concurrently.
Eg, you can send a SoupMessage in one thread, and then while
waiting for the response, send another SoupMessage from another
thread. You can also send a message from one thread and then call
soup_session_cancel_message()
on it from any other thread (although
you need to be careful to avoid race conditions, where the message
finishes and is then unreffed by the sending thread just before you
cancel it).
However, the majority of other types and methods in libsoup are not MT-safe. In particular, you cannot modify or examine a SoupMessage while it is being transmitted by SoupSessionSync in another thread. Once a message has been handed off to SoupSessionSync, it can only be manipulated from its signal handler callbacks, until I/O is complete.
SoupSession* soup_session_sync_new (void);
Creates an synchronous SoupSession with the default options.
Returns : | the new session. |
SoupSession* soup_session_sync_new_with_options (const char *optname1, ...);
Creates an synchronous SoupSession with the specified options.
optname1 : |
name of first property to set |
... : |
value of optname1 , followed by additional property/value pairs
|
Returns : | the new session. |