polserver/pol-core/bscript/bobject.cpp
turleypol 803b372b8f
Misc modernizations and improvments (#896)
* fixed_allocator cleanup
template argument is now the type and not the size
general cleanup, rewrote refill loop to better understand whats
happening
possibility to use different alignments (not needed for the used types)

* adapted fixed_allocator usage

* simplified message_queue conditial wait, removed unused header

* use moveonlyfunction for logging queue

* cleanup and performance improvment for clienttransmit

* use moveonlyfunction for sql

* fixed use after move

* TaskThreadPool uses moveonlyfunction

* catch exception locally without stopping the complete workerthread

* message_queue pop with timeout

* DynTaskThreadPool changes

- using move_only_function
- general simplification
- minimum of 4 threads
- added idle timeout to get rid of workers

* simplified auxpoolthread usage

* fixed threadmap initialization

* to avoid static initialization problem dont prefill worker threada in
the constructor
update macos to latest which hopefully supports jthreads

* removed debug logs

* seems macos-latest is not always 26, explicitly use it

* added jitter for timeout
secured the logic when to spawn a new thread more
busyguard is now used to track a message compare value against
live_threads to decide if a new thread should be spawned
unique name per poolworker
2026-07-14 19:04:07 +02:00

61 lines
1.4 KiB
C++

/** @file
*
* @par History
* - 2005/11/26 Shinigami: changed "strcmp" into "stricmp" to suppress Script Errors
* - 2008/02/11 Turley: ObjArray::unpack() will accept zero length Arrays and Erros from
* Array-Elements
* - 2009/09/05 Turley: Added struct .? and .- as shortcut for .exists() and .erase()
* - 2009/12/21 Turley: ._method() call fix
*/
#include "bobject.h"
namespace Pol::Bscript
{
Clib::fixed_allocator<BObject, 256> bobject_alloc;
size_t BObjectRef::sizeEstimate() const
{
if ( get() )
return sizeof( BObjectRef ) + get()->sizeEstimate();
return sizeof( BObjectRef );
}
size_t BObject::sizeEstimate() const
{
if ( objimp.get() )
return sizeof( BObject ) + objimp.get()->sizeEstimate();
return sizeof( BObject );
}
BObject* BObject::clone() const
{
return new BObject( objimp->copy() );
}
bool BObject::operator!=( const BObject& obj ) const
{
return *objimp != *( obj.objimp );
}
bool BObject::operator==( const BObject& obj ) const
{
return *objimp == *( obj.objimp );
}
bool BObject::operator<( const BObject& obj ) const
{
return *objimp < *( obj.objimp );
}
bool BObject::operator<=( const BObject& obj ) const
{
return *objimp <= *( obj.objimp );
}
bool BObject::operator>( const BObject& obj ) const
{
return *objimp > *( obj.objimp );
}
bool BObject::operator>=( const BObject& obj ) const
{
return *objimp >= *( obj.objimp );
}
} // namespace Pol::Bscript