WaitForMethodEntry blocks until the method on class is entered, and then returns the method entry event. All threads are suspended when the method returns.
(ctx context.Context, class ClassID, method MethodID)
| 83 | // returns the method entry event. |
| 84 | // All threads are suspended when the method returns. |
| 85 | func (c *Connection) WaitForMethodEntry(ctx context.Context, class ClassID, method MethodID) (*EventMethodEntry, error) { |
| 86 | var out *EventMethodEntry |
| 87 | |
| 88 | onEvent := func(event Event) bool { |
| 89 | e := event.(*EventMethodEntry) |
| 90 | if e.Location.Method == method { |
| 91 | out = e |
| 92 | return false |
| 93 | } |
| 94 | c.ResumeAll() |
| 95 | return true |
| 96 | } |
| 97 | |
| 98 | err := c.WatchEvents(ctx, MethodEntry, SuspendAll, onEvent, ClassOnlyEventModifier(class)) |
| 99 | if err != nil { |
| 100 | return nil, err |
| 101 | } |
| 102 | |
| 103 | return out, nil |
| 104 | } |
no test coverage detected