Concept Framework 2.0 documentation Contents | Index

standard.lib.shared.share_open

Name Version Deprecated
share_open version 1.0 no

Prototype:
number share_open(number key[, boolean bReadOnly=false])

Parameters:
key      the key used to identify the shared memory segment
bReadOnly      true if the segment cannot be written

Description:
Accesses a previously created shared memory segment. The segment identified by key must exist; you can create shared memory segments with share_create.

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";
		}
	}
}

Returns:
Returns a shared memory handle. If failed, a run time error is raised. For controlling run-time errors you should set at the beginning of your program: pragma lib_exceptions on

Documented by Eduard Suica, generation time: Fri Jan 21 18:06:21 2011 GMT(c)2011 RadGs Software