ThreadCaffeine


Derived from: none

Declared in: ThreadCaffeine.h

Library: libHTTP.so


Overview


The ThreadCaffeine class can be used to wakeup a thread which has been blocking too long. I created it because the Network Kit is still buggy and can block indefinetly on io requests. Especially if the remote closes the connection in the middle of an io task. While this wakes up the threads which employ the ThreadCaffeine, allowing them to calls closesocket() and exit gracefully, often the threads in the Net Server still don't wakeup and after calling closesocket(). This leads to a buildup of zombie threads in the Net Server and can eventually lead to the death of the Net Server. Hopefully all of this will be fixed soon. Right? Then we will no longer need lame hacks like ThreadCaffeine.


Constructor and Destructor


ThreadCaffeine()


	ThreadCaffeine( bigtime_t sleep = 10000000 )


~ThreadCaffeine()


	virtual ~ThreadCaffeine( void )


Member Functions


SetTeam()


	status_t SetTeam( team_id team )


Run()


	thread_id Run( void )


Quit()


	status_t Quit( void )


AddThread()


	status_t AddThread( const char *thread_name )
	status_t AddThread( thread_id thread, bigtime_t timeout )


RemoveThread()


	status_t RemoveThread( thread_id thread )


WaitForThreads()


	void WaitForThreads( bool wake )


libHTTP - A high-level HTTP API for the BeOS


Copyright (C) 1999 Joe Kloss