@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2022 Jonathan Schleifer + * Copyright (c) 2008-2024 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -124,10 +124,14 @@ */ @interface OFSequencedPacketSocket: OFObject { OFSocketHandle _socket; +#ifdef OF_AMIGAOS + LONG _socketID; /* unused, reserved for ABI stability */ + int _family; /* unused, reserved for ABI stability */ +#endif bool _canBlock, _listening; OFSocketAddress _remoteAddress; id _Nullable _delegate; OF_RESERVE_IVARS(OFSequencedPacketSocket, 4) } @@ -135,10 +139,11 @@ /** * @brief Whether the socket can block. * * By default, a socket can block. * + * @throw OFGetOptionFailedException The option could not be retrieved * @throw OFSetOptionFailedException The option could not be set */ @property (nonatomic) bool canBlock; /** @@ -365,10 +370,34 @@ /** * @brief Cancels all pending asynchronous requests on the socket. */ - (void)cancelAsyncRequests; +/** + * @brief Releases the socket from the current thread. + * + * This is necessary on some platforms in order to allow a different thread to + * use the socket, e.g. on AmigaOS, but you should call it on all operating + * systems before using the socket from a different thread. + * + * After calling this method, you must no longer use the socket until + * @ref obtainSocketForCurrentThread has been called. + */ +- (void)releaseSocketFromCurrentThread; + +/** + * @brief Obtains the socket for the current thread. + * + * This is necessary on some platforms in order to allow a different thread to + * use the socket, e.g. on AmigaOS, but you should call it on all operating + * systems before using the socket from a different thread. + * + * You must only call this method after @ref releaseSocketFromCurrentThread has + * been called from a different thread. + */ +- (void)obtainSocketForCurrentThread; + /** * @brief Closes the socket so that it can neither receive nor send any more * datagrams. * * @throw OFNotOpenException The socket is not open