25.06.2011, 06:15 
	(
 Последний раз редактировалось Fro1sha; 26.06.2011 в 06:43.
)
	
	
		Description:
Log:
Example:
Download:
	
	
	
	
This is MultiThread plugin. And I don't know what to write hereAttention:. Examples speak for themselves.
http://en.wikipedia.org/wiki/Multith...rchitecture%29
Quote:
| PAWN is not designed to be multi-threaded and there are no guarantees AT ALL on your data the moment you introduce threads. | 
Wrong using this plugin can significantly corrupt your gamemode.How to use:
pawn Код:
#include <thread>
- 0.1.6- Added new native CreateThreadEx( const pubname[ ] ); 
- 0.1.5- First release. 
pawn Код:
native CreateThread( const pubname[ ] );
native CreateThreadEx( const pubname[ ] );
native DestroyThread( threadid );
native SleepThread( milliseconds ); // Use in thread (public)
native LockThread( threadid ); // Synchronize will return the id lock
native UnLockThread( lockid );
With CreateThread
pawn Код:
new tickid;
public OnGameModeInit()
{
tickid = CreateThread( "MyFunction" );
}
public OnGameModeExit()
{
DestroyThread( tickid );
}
public MyFunction( threadid )
{
printf( "tick(%d)...", threadid );
SleepThread( 1000 );
}
With CreateThreadEx
pawn Код:
new bool:active;
new tickid;
public OnGameModeInit()
{
tickid = CreateThreadEx( "MyFunction" );
}
public OnGameModeExit()
{
active = false;
}
public MyFunction( threadid )
{
active = true;
while ( active )
{
printf( "tick(%d)...", threadid );
SleepThread( 1000 );
}
}






 
	

 
	