standard.lib.shared.share_link_count

share_link_count is available since version 1.0.

Prototype:

number share_link_count(number share_handle)

Parameters

share_handle
the shared memory handle as returned by share_create or share_open.

Description:

Gets the links count to a shared segment.

Return value:

Returns the number of links to a shared memory segment.

Example
import standard.lib.shared

class Main {
	function Main() {
		var ctx=share_open(123);
		echo ctx;
		share_lock(ctx);
		for (var i=0;i<200000;i++) {
			share_set(ctx,""+i);
		}
		echo "done lock";
		echo "SH:"+share_unlock(ctx)+"\n";
		echo "SH:"+share_unlock(ctx)+"\n";
		echo share_get(ctx);
		echo "\n";
		echo typeof this;
		while (1) {
			echo ""+share_link_count(ctx)+"\r";
		}
	}
}