load_program :-
        load_files([
		    % self okay?
		    %  NO.  load_program,
		    %
		    mt,
		    my_http_client,
		    app_config,
		    log,
		    qtest,
		    argv,
		    rdfpage,
		    focus,
		    stats,
		    reply,
		    self_uri,
		    html,
		    harvest_watch,
		    submit,
		    search,
		    pagein,
		    basicpage,
		    assert_header_rdf,
		    hosting,
		    looks_like_ontology,
		    schedule,
		    harvest,
		    views,
		    cache_views,  list_views,  property_views,  server_views,  short_views,  source_views, 
		    ontology_page_view,
		    summary_view,
		    home,
		    index,
		    retrieve,
		    webload,
		    thread_util,
		    static_reply,
		    convert,
		    time_conversions,
		    genid,
		    robot_excl,
		    retrieval_metadata,
		    shell,
		    uri,
		    download,
		    upload,
		    precache,
		    findsome,
		    db,
		    persistent_term_index,
		    ontology_view,
		    person,
		    parse,

		    % total hack:
		    workshop_support,
		    rule_systems
		   ], 
		   [if(changed), silent(true)]).

reload_program_if_safe :-
	%   "safe" is not 100%.    nasty results (eg SEGV) seem to come if
	%   change the code of a running thread (eg harvest_loop).  Not
	%   sure it's worth automating catching that.   Not sure how to
	%   lock everyone down though.....
	%
        /*    this works around a bug in an old version, fixed by 5.3.10 
	length(L, ThreadCount),
	(   ThreadCount = 1
	->  load
	;   true
	),

        */
	(   current_prolog_flag(saved_program, true)
	->  true
	;   get_time(Now),
	    (   flag(last_load_program_time, Last, Last),
		Ago is Now - Last,
		Ago < 0.2
	    ->  true   %  it was last loaded VERY recently; don't
	               %  bother checking.   This check might help
	               %  a lot under very high loads.
	    ;   load_program,
		get_time(DoneTime),
		flag(last_load_program_time, _, DoneTime)
	    )
	).

	
