I don't see how that answers the question. As the FAQ states, enet doesn't use any significant global variables, but it definitely uses 'some' or else we wouldn't be required to call a global initialize function. The question is whether a second call will reset anything that existing ENetHost structures rely on.
> So my assumption would be NO, but you could try .. but why you would want > to call this multiple times is a mystery, maybe rethink your application > design .. As I said in my original post, most APIs on Windows let you call initialize functions multiple times in case you want to be absolutely sure something is initialized before using it. What if you happen to use two (unrelated) libraries in your project that both use enet internally? Unless those two libraries defer to the caller to initialize enet (which might not be intended at all if the library is supposed to hide away such details) then there's no way for me to guarantee that enet_initialize() won't be called twice in the same process. I already worked around this 'issue' in my own code, but I'm mostly just being proactive here and trying to determine if it'd be possible or not. > -----Original Message----- > From: [email protected] [mailto:enet-discuss- > [email protected]] On Behalf Of Ross Linder > Sent: Tuesday, July 26, 2011 11:39 PM > To: Discussion of the ENet library > Subject: Re: [ENet-discuss] Calling enet_initialise() more than once > > I think the FAQ answers this pretty much .. > > --> > Is ENet thread safe? > > ENet does not use any significant global variables, the vast majority of state > is encapsulated in the ENetHost structure. As such, as long as the > application guards access to this structure, then ENet should operate fine in > a multithreaded environment. > <-- > > So my assumption would be NO, but you could try .. but why you would want > to > call this multiple times is a mystery, maybe rethink your application > design .. > -- > > On Tuesday 26 July 2011 20:09:09 Soren Dreijer wrote: > > Am I allowed to call enet_initialize() more than once in my application? > > I'm coming from the world of Windows where most APIs, such as > WSAStartup() > > or CoInitializeEx(), can be called multiple times as long as their cleanup > > counterparts are called the same number of times. > > > > > > > > Is that true for enet as well or will enet_initialize() reset any already > > initialized global state thereby potentially messing up other parts of my > > application that currently use enet? > > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss _______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
