A TT_BOTH
-scoped pattern will match messages that are scoped to the file, the session, or the file and the session. However, when you use this scope, you must explicitly make a tt_file_join call; otherwise, the ToolTalk service will only match messages that are scoped to both the file and session of the registered pattern. Example 3-8 and Example 3-9 show examples of how to use this scope.
TT_BOTH
Scope
Obtain procid |
tt_open(); |
Create pattern |
Tt_pattern pat = tt_create_pattern(); |
Add scope to pattern |
tt_pattern_scope_add(pat, TT_BOTH); |
Add session to pattern |
tt_pattern_session_add(pat,tt_default_session()); |
Add file to pattern |
tt_pattern_file_add (pat, file); |
Register pattern |
tt_pattern_register(pat); |
TT_BOTH
Scope
Obtain procid |
tt_open(); |
Declare Ptype |
Tt_ptype_declare(ptype); |
Join file |
tt_file_join(file); |
Join session |
tt_session_join(tt_default_session()); |