synchronization of two waveforms

i have two devices that each generate a waveform of some frequency and phase, and i'd like to be able to input and process them, such that they can be synchronized to have the same frequency and phase (in an active-feedback-and-control kind of way.) my thought was to manipulate the timers/registers by using one as an external clock source and somehow calibrating that to the microprocessor clock, but i'm completely out of my depth here. i've read all of the related posts i can find, and several articles on the playground (including the infinitely helpful does anyone have thought on the best way to implement something like this? it seems like it should be really simple, but somehow, it's eluding me.

i have two devices that each generate a waveform of some frequency and phase

In order to synchronise these two devices you will have to have some sort of control over them. What sort of control we don't know because you haven't told us. Without more information we can't possibly help.

sorry about that, grumpy mike. yes, clearly, i need control over the waveforms for active feedback and control, and i have that. i can adjust frequency, duty cycle, phase, pretty much any part of the waveforms. my question is really how to sample the waveforms and define one rising edge as a reference (t0). i'm thinking now that maybe i could use an interrupt for that, i.e. when the signal goes high for waveform 1, set t0. i can record the period of each waveform and pretty easily match those (i think), and then if i can subtract the waveform 2 from waveform 1, i should be able determine the required phase compensation. i wonder, though, if there's a simpler or more practical way to do this. often, i tend to make things harder than they need to be.

I think you have to choose which one you want to have as the master. Basically play it like it was a phase locked loop. Generate a number that represents the degree of the out of phase and then apply that as a feedback control.