<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>bnet and Threads</TITLE> <META NAME="description" CONTENT="bnet and Threads"> <META NAME="keywords" CONTENT="developers"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="developers.css"> <LINK REL="next" HREF="bnet_open.html"> <LINK REL="previous" HREF="General.html"> <LINK REL="up" HREF="TCP_IP_Network_Protocol.html"> <LINK REL="next" HREF="bnet_open.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1657" HREF="bnet_open.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1651" HREF="TCP_IP_Network_Protocol.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1645" HREF="General.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1653" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1655" HREF="GNU_Free_Documentation_Lice.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1658" HREF="bnet_open.html">bnet_open</A> <B> Up:</B> <A NAME="tex2html1652" HREF="TCP_IP_Network_Protocol.html">TCP/IP Network Protocol</A> <B> Previous:</B> <A NAME="tex2html1646" HREF="General.html">General</A> <B> <A NAME="tex2html1654" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html1656" HREF="GNU_Free_Documentation_Lice.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION001820000000000000000"></A> <A NAME="6223"></A> <A NAME="6224"></A> <BR> bnet and Threads </H1> <P> These bnet routines work fine in a threaded environment. However, they assume that there is only one reader or writer on the socket at any time. It is highly recommended that only a single thread access any BSOCK packet. The exception to this rule is when the socket is first opened and it is waiting for a job to start. The wait in the Storage daemon is done in one thread and then passed to another thread for subsequent handling. <P> If you envision having two threads using the same BSOCK, think twice, then you must implement some locking mechanism. However, it probably would not be appropriate to put locks inside the bnet subroutines for efficiency reasons. <P> <BR><HR> <ADDRESS> 2010-06-14 </ADDRESS> </BODY> </HTML>